constrainLayout无法预览.render error 2C

-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个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问