gpt4 book ai didi

java - 安卓 ButterKnife java.lang.NoClassDefFoundError : Failed resolution of: Lbutterknife/ButterKnife

转载 作者:行者123 更新时间:2023-11-29 19:48:58 27 4
gpt4 key购买 nike

当我尝试在我的 Android 项目中使用 Butterknife 时出现以下异常:

05-20 14:08:41.221 3296-3296/com.fedorparetsky.parcare E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.fedorparetsky.parcare, PID: 3296
java.lang.NoClassDefFoundError: Failed resolution of: Lbutterknife/ButterKnife;
at com.fedorparetsky.parcare.LoginActivity.onCreate(LoginActivity.java:31)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: java.lang.ClassNotFoundException: Didn't find class "butterknife.ButterKnife" on path: DexPathList[[dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-support-annotations-23.4.0_eb12f1d5e0839cb98757858d3f14e58a5ea14ee3-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-retrofit-2.0.2_317900fd1983688c01450d1ec5906c5a1c05efd1-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-okio-1.6.0_175d7b922c34081b4b832410087e3085fd821d1c-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-okhttp-3.2.0_2ceb2f44f424d23ee9f0690f9e73329608c061a6-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-mysql-connector-java-5.1.25_355d4321be27ecaa8afcdd4b2c17d478c5f6a2c4-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-library-2.4.0_681824be31b9a4f5b9013c1feaea61615d3e4a07-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-internal_impl-23.4.0_6314a7d5980c15845346b6a8b9008223f1faf2b5-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-internal_impl-23.0.0_f9a9db9ee308ac3c11b109ec40e9df56aa8ca9a9-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-gson-2.6.1_12043eecea4526f7c51479e9dc708e34fcb0a90e-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-converter-gson-2.0.2_c0961e237a04b3dab9580cd6b92b08285cdb39c3-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-com.google.maps.android-android-maps-utils-0.3.4_dac5ffeda914d4aeb6f30b42d562dbab006824c8-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instant-run/dex/slice-com.google.android.gms-play-services-wearable-8.4.0_6287478ed3658867eb338478fc08f15b9de30ed5-classes.dex", dex file "/data/data/com.fedorparetsky.parcare/files/instan

这是我的应用程序gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.somepackage.someapplicationname"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}

}
apply plugin: 'com.neenbedankt.android-apt'

dependencies {
compile 'com.google.code.gson:gson:2.5'
compile 'mysql:mysql-connector-java:5.1.25'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}

这是我的项目gradle:

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这里是与 Butterknife 相关的一切发生的背景:

    @BindView(R.id.input_email) AppCompatEditText _emailText;
@BindView(R.id.input_password) AppCompatEditText _passwordText;
@BindView(R.id.btn_login) Button _loginButton;
@BindView(R.id.link_signup) TextView _signupLink;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);
...
}

看起来我遵循了 Butterknife 的安装说明,所以我不确定发生了什么。有什么我需要解决的吗?

最佳答案

重建项目编译了整个项目,而不仅仅是单个类(在 Insta Run 中),这解决了问题。

关于java - 安卓 ButterKnife java.lang.NoClassDefFoundError : Failed resolution of: Lbutterknife/ButterKnife,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37355981/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com