我想將RecyclerView添加到我繼承的項目中,該項目是針對API 19編譯的,不能更高。無法將RecyclerView添加到API級別19
後,我添加RecylerView從支持庫這樣的:
compile 'com.android.support:recyclerview-v7:+'
該項目不再建設,它開始給multidex異常錯誤是這樣的:
Error:Execution failed for task ':app:transformClassesWithDexForDevDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 3
要解決這個問題,我已完成以下操作
- 啓用multidex支持像這樣
multiDexEnabled true
- 添加
compile 'com.android.support:multidex:1.0.1'
- 在Applciation類安裝multidex像這樣:
MultiDex.install(this);
所有這一切都沒有幫助。以下是運行./gradlew應用程序的依賴關係圖:依賴關係
根據下圖,我需要做出什麼更改才能生成項目?
compile - Classpath for compiling the main sources.
+--- com.android.support:multidex:1.0.1
+--- org.simpleframework:simple-xml:2.7.1
| \--- stax:stax:1.2.0
+--- com.squareup.retrofit2:converter-simplexml:2.0.0-beta3
| +--- com.squareup.retrofit2:retrofit:2.0.0-beta3
| | \--- com.squareup.okhttp3:okhttp:3.0.0-RC1
| | \--- com.squareup.okio:okio:1.6.0
| \--- org.simpleframework:simple-xml:2.7.1 (*)
+--- com.crashlytics.sdk.android:crashlytics:2.5.5
| +--- com.crashlytics.sdk.android:answers:1.3.6
| | \--- io.fabric.sdk.android:fabric:1.3.10
| +--- com.crashlytics.sdk.android:crashlytics-core:2.3.8
| | +--- com.crashlytics.sdk.android:answers:1.3.6 (*)
| | \--- io.fabric.sdk.android:fabric:1.3.10
| +--- io.fabric.sdk.android:fabric:1.3.10
| \--- com.crashlytics.sdk.android:beta:1.1.4
+--- com.crashlytics.sdk.android:crashlytics-ndk:1.1.2
| +--- io.fabric.sdk.android:fabric:1.3.7 -> 1.3.10
| \--- com.crashlytics.sdk.android:crashlytics-core:2.3.5 -> 2.3.8 (*)
+--- commons-net:commons-net:3.3
+--- com.github.danysantiago:sendgrid-android:1
| +--- org.apache.httpcomponents:httpmime:4.3.5
| | \--- org.apache.httpcomponents:httpclient:4.3.5
| | +--- org.apache.httpcomponents:httpcore:4.3.2
| | +--- commons-logging:commons-logging:1.1.3
| | \--- commons-codec:commons-codec:1.6
| \--- org.apache.httpcomponents:httpclient-android:4.3.5.1
+--- com.amazonaws:aws-android-sdk-core:2.2.11
| \--- com.google.code.gson:gson:2.2.4
+--- com.amazonaws:aws-android-sdk-s3:2.2.11
| \--- com.amazonaws:aws-android-sdk-core:2.2.11 (*)
+--- com.google.code.ksoap2-android:ksoap2-android:3.6.0
| \--- com.google.code.ksoap2-android:ksoap2-j2se:3.6.0
| \--- com.google.code.ksoap2-android:ksoap2-base:3.6.0
| +--- net.sourceforge.kxml:kxml:2.2.4
| | \--- org.xmlpull:xmlpull:1.1.3.3
| \--- net.sourceforge.kobjects:kobjects-j2me:0.0-SNAPSHOT-20040926-2
+--- com.squareup.retrofit2:retrofit:2.0.0-beta3 (*)
\--- com.android.support:recyclerview-v7:+ -> 24.1.1
+--- com.android.support:support-v4:24.1.1
| \--- com.android.support:support-annotations:24.1.1
\--- com.android.support:support-annotations:24.1.1
下面是完整的搖籃輸出https://dl.dropboxusercontent.com/u/15447938/gradle_output.txt
下面是完整的構建輸出
Information:Gradle tasks [:app:assembleDevDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for prodDebug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for prodRelease as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for devDebug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.3.5 is ignored for devRelease as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDevDebugBuild UP-TO-DATE
:app:checkDevDebugManifest
:app:preDevReleaseBuild UP-TO-DATE
:app:preProdDebugBuild UP-TO-DATE
:app:preProdReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72411Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42411Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidAnswers136Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidBeta114Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlytics255Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore238Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlyticsNdk112Library UP-TO-DATE
:app:prepareComGithubDanysantiagoSendgridAndroid1Library UP-TO-DATE
:app:prepareIoFabricSdkAndroidFabric1310Library UP-TO-DATE
:app:prepareDevDebugDependencies
:app:compileDevDebugAidl UP-TO-DATE
:app:compileDevDebugRenderscript UP-TO-DATE
:app:generateDevDebugBuildConfig UP-TO-DATE
:app:generateDevDebugAssets UP-TO-DATE
:app:mergeDevDebugAssets UP-TO-DATE
:app:processDevDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDevDebug
:app:generateDevDebugResValues UP-TO-DATE
:app:generateDevDebugResources
:app:mergeDevDebugResources
:app:processDevDebugResources
:app:generateDevDebugSources
:app:compileDevDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDevDebugNdk
:app:compileDevDebugSources
:app:transformClassesWithDexForDevDebug
Warning:Ignoring InnerClasses attribute for an anonymous inner class
(com.bea.xml.stream.util.CircularQueue$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:transformClassesWithDexForDevDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 1 mins 10.137 secs
Information:1 error
Information:5 warnings
Information:See complete output in console
我不認爲Gradle錯誤顯然與MultiDex有關,因爲添加MultiDex顯然沒有幫助 –
是的,我將刪除multidex。但是該項目仍然沒有構建 –
請問您能添加更多的Gradle輸出嗎? –