bzb123321
CodingTrueMan
采纳率0%
2017-06-29 03:41 阅读 2.3k

constrainLayout无法预览.render error

2

-failed to instantiate one or more classes
java.lang.NoSuchFieldError: ConstraintLayout_Layout
at android.support.constraint.ConstraintLayout.init(ConstraintLayout.java:440)
at android.support.constraint.ConstraintLayout.(ConstraintLayout.java:420)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:262)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:220)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

gradle 

dependencies {
final ANDROID_VERSION = '26.+'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "com.android.support:appcompat-v7:$ANDROID_VERSION"
compile "com.android.support:recyclerview-v7:$ANDROID_VERSION"
compile "com.android.support:design:$ANDROID_VERSION"
compile "com.android.support:cardview-v7:$ANDROID_VERSION"
compile "com.android.support:support-v4:$ANDROID_VERSION"
compile "com.android.support:recyclerview-v7:$ANDROID_VERSION"
compile "com.android.support:support-annotations:$ANDROID_VERSION"
compile files('libs/eventbus-3.0.0.jar')
//    支持 vector 图片资源
compile "com.android.support:support-vector-drawable:$ANDROID_VERSION"
//  ButterKnife
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
// 权限申请
compile 'pub.devrel:easypermissions:0.4.2'
//    leakCanary 泄漏检测
final LEAKCANARY_VERSION = '1.5'
debugCompile "com.squareup.leakcanary:leakcanary-android:$LEAKCANARY_VERSION"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$LEAKCANARY_VERSION"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$LEAKCANARY_VERSION"
compile project(path: ':bzblibrary')

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • zanjiaowei smile_邝野 2017-06-30 01:56

    java.lang.NoSuchFieldError: ConstraintLayout_Layout 你看下布局那里用到ConstraintLayout_Layout 的地方,这个的加包名呢,

    点赞 评论 复制链接分享

相关推荐