为什么黄油刀9.0.0-SNAPSHOT无法解决?

时间:2018-09-12 11:42:29

标签: android androidx butterknife

我想使用AndroidX库,下面是我的Butterknife的Gradle设置

app:模块依赖性

    09-11 16:05:48.720 10206-10229/? E/OpaEligibilityChecker: Updating xpromo flags, clock app not present.
09-11 16:05:49.090 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:49.090 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:49.190 440-1316/? E/qomx_image_core: OMX_Deinit:118] Complete
09-11 16:05:49.190 440-1316/? E/QCameraPostProc: int32_t qcamera::QCameraPostProcessor::deinit(): Jpeg closed, rc = 0, mJpegClientHandle = 4d00
09-11 16:05:49.200 462-10261/? E/mm-camera-sensor: module_sensor_stop_session:867 session 1
09-11 16:05:49.200 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 5
09-11 16:05:49.200 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 4
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 3
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 2
09-11 16:05:49.210 462-10261/? E/mm-camera-sensor: sensor_close:3967 (0)sensor_close CFG_POWER_DOWN 
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 1
09-11 16:05:49.240 462-10261/? E/mm-camera-sensor: module_sensor_stop_session:902 module_sensor_stop_session:send stop sensor thread,fd:29
09-11 16:05:49.250 462-9993/? E/mm-camera: Got some events
    sensor_thread_func:160 sensor_thread_func:Sensor thread is exiting
09-11 16:05:49.250 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 0
09-11 16:05:49.260 9868-9918/? E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
09-11 16:05:49.610 10281-10281/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_dependencies_apk.apk@classes.dex: Permission denied
09-11 16:05:50.260 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:50.260 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:50.560 10339-10339/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_0_apk.apk@classes.dex: Permission denied
09-11 16:05:50.640 10342-10342/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_1_apk.apk@classes.dex: Permission denied
09-11 16:05:50.720 10349-10349/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_2_apk.apk@classes.dex: Permission denied
09-11 16:05:50.790 10351-10351/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_3_apk.apk@classes.dex: Permission denied
09-11 16:05:50.850 10353-10353/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_4_apk.apk@classes.dex: Permission denied
09-11 16:05:50.930 10356-10356/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_5_apk.apk@classes.dex: Permission denied
09-11 16:05:50.980 10359-10359/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_6_apk.apk@classes.dex: Permission denied
09-11 16:05:51.070 10363-10363/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_7_apk.apk@classes.dex: Permission denied
09-11 16:05:51.140 10366-10366/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_8_apk.apk@classes.dex: Permission denied
09-11 16:05:51.230 10370-10370/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@split_lib_slice_9_apk.apk@classes.dex: Permission denied
09-11 16:05:52.660 10267-10267/ir.abfacs.abfacsandroid E/Photo test: 1-mCurrentPhotoPath: null

插件

implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT' annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'

项目依赖性

apply plugin: 'com.jakewharton.butterknife'

项目存储库

dependencies {
      classpath 'com.android.tools.build:gradle:3.3.0-alpha09'
      classpath 'com.google.gms:google-services:4.0.1'
      classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
    }

7 个答案:

答案 0 :(得分:17)

更新: 现在,您可以简单地使用ButterKnife 9-rc02代替上述解决方案:

...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-rc2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
...

根据Naveen的回答,解决方案是here
但是,缺少细节。请参考以下Gradle配置以获取完整解决方案:

buildscript {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven {
            name 'Sonatype SNAPSHOTs';
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
}

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



...
dependencies {
    implementation 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
...

基本上,不要使用建议here中的apply plugin: 'com.jakewharton.butterknife'classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'

此外,此Android Studio设置>编译器配置: Android Studio Settings > Compiler configuration

答案 1 :(得分:3)

添加 name 'Sonatype SNAPSHOTs';

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3' //3.1.4

    }

    buildscript {
            repositories {
                google()
                jcenter()
                mavenCentral()
                // TODO remove after butterknife 9 graduates to stable
                maven {
                    name 'Sonatype SNAPSHOTs';
                    url 'https://oss.sonatype.org/content/repositories/snapshots/'
                }

            }

仅供参考

您可以使用

   implementation 'com.jakewharton:butterknife:8.8.1'
   annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

阅读Butter Knife

答案 2 :(得分:1)

看到有关黄油刀9.0.0-SNAPSHOT与Android Studio 3.0之间冲突的对话。
https://github.com/JakeWharton/butterknife/issues/1145

答案 3 :(得分:1)

请注意,Butterknife现在已达到10.1.0,不再需要SNAPSHOT版本或任何其他Maven库。 AndroidX迁移颇具魅力。只需包括:

dependencies {
    implementation 'com.jakewharton:butterknife:10.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}

,或者,如果出于某种原因您将Kotlin和黄油刀组合在一起,则将annotationProcessor替换为kapt

有关更多信息,请访问: https://github.com/JakeWharton/butterknife

答案 4 :(得分:0)

还添加了对Java 1_8的支持 android 部分中的 build.gradle

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

答案 5 :(得分:0)

按照GitHub存储库中的说明进行操作,该说明可为我100%使用最新版本here

答案 6 :(得分:-1)

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

它在androidx中工作