Android dex 64k错误eclipse

时间:2015-01-11 10:09:45

标签: android maven

我在Eclipse上的一个项目中遇到了dex 64k方法错误。

我发现的一个可能的解决方案是使用maven,因为它具有多dex支持。 在运行:mvn clean install时,我遇到了以下错误。

我是maven的新手,请帮忙:

[DEBUG] Configuring mojo com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources from plugin realm ClassRealm[plugin>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2, parent: sun.misc.Launcher$AppClassLoader@7d487b8b]
[DEBUG] Configuring mojo 'com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources' with basic configurator -->
[DEBUG]   (f) aaptExtraArgs = []
[DEBUG]   (f) androidManifestFile = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/AndroidManifest.xml
[DEBUG]   (f) assetsDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/assets
[DEBUG]   (f) attachJar = true
[DEBUG]   (f) attachSources = false
[DEBUG]   (f) buildConfigConstants = []
[DEBUG]   (f) combinedAssets = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets
[DEBUG]   (f) envAndroidHome = /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk
[DEBUG]   (f) execution = com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources {execution: default-generate-sources}
[DEBUG]   (f) extractedDependenciesDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/extracted-dependencies
[DEBUG]   (f) extractedDependenciesJavaResources = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/extracted-dependencies/src/main/resources
[DEBUG]   (f) extractedDependenciesJavaSources = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/extracted-dependencies/src/main/java
[DEBUG]   (f) genDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/r
[DEBUG]   (f) genDirectoryAidl = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/aidl
[DEBUG]   (f) generateApk = true
[DEBUG]   (f) mergeManifests = false
[DEBUG]   (f) nativeLibrariesDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/libs
[DEBUG]   (f) project = MavenProject: com.bcd.app:bcdapp:1.0.0 @ /home/vivek/Documents/WorkspaceIntermediary/BCDApp/pom.xml
[DEBUG]   (f) projectRepos = [central (https://repo.maven.apache.org/maven2, releases)]
[DEBUG]   (f) release = false
[DEBUG]   (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@25dafe28
[DEBUG]   (f) resourceDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res
[DEBUG]   (f) resourceOverlayDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res-overlay
[DEBUG]   (f) platform = 21
[DEBUG]   (f) sdk = com.jayway.maven.plugins.android.configuration.Sdk@3b290efc
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@496e0bc
[DEBUG]   (f) sourceDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/src
[DEBUG]   (f) targetDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target
[DEBUG]   (f) undeployBeforeDeploy = false
[DEBUG]   (f) unpackedApkLibsDirectory = /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/unpacked-libs
[DEBUG] -- end configuration --
[DEBUG] Copying /home/vivek/Documents/WorkspaceIntermediary/BCDApp/assets to /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[DEBUG] mergeManifests: false
[INFO] Manifest merging disabled. Using project manifest only
[DEBUG] Generating R file for apk
[DEBUG] Resource overlay folders : [/home/vivek/Documents/WorkspaceIntermediary/BCDApp/res-overlay]
[DEBUG] Adding resource folder : /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res
[DEBUG] Adding assets folder : /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets
[INFO] /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/build-tools/android-4.4W/aapt [package, -f, --no-crunch, -I, /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-21/android.jar, -M, /home/vivek/Documents/WorkspaceIntermediary/BCDApp/AndroidManifest.xml, -S, /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res, -A, /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets, -m, -J, /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/r, --output-text-symbols, /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target, --auto-add-overlay]
[INFO] /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res/values/styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[INFO] /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res/values-v11/styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
[INFO] /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res/values-v14/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[DEBUG] ANDROID-040-000: Executed command: Commandline = /bin/sh -c cd /home/vivek/Documents/WorkspaceIntermediary/BCDApp && /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-21/android.jar -M /home/vivek/Documents/WorkspaceIntermediary/BCDApp/AndroidManifest.xml -S /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res -A /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets -m -J /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/r --output-text-symbols /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target --auto-add-overlay, Result = 1
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException: 
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:593)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/vivek/Documents/WorkspaceIntermediary/BCDApp && /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-21/android.jar -M /home/vivek/Documents/WorkspaceIntermediary/BCDApp/AndroidManifest.xml -S /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res -A /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets -m -J /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/r --output-text-symbols /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target --auto-add-overlay, Result = 1
    at com.jayway.maven.plugins.android.CommandExecutor$Factory$DefaultCommandExecutor.executeCommand(CommandExecutor.java:246)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:589)
    ... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.927 s
[INFO] Finished at: 2015-01-11T15:32:54+05:30
[INFO] Final Memory: 15M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project bcdapp: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/vivek/Documents/WorkspaceIntermediary/BCDApp && /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /home/vivek/Documents/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-21/android.jar -M /home/vivek/Documents/WorkspaceIntermediary/BCDApp/AndroidManifest.xml -S /home/vivek/Documents/WorkspaceIntermediary/BCDApp/res -A /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/combined-assets/assets -m -J /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target/generated-sources/r --output-text-symbols /home/vivek/Documents/WorkspaceIntermediary/BCDApp/target --auto-add-overlay, Result = 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project bcdapp: 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: 
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:593)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more

1 个答案:

答案 0 :(得分:0)

使用Android studio是尝试了很多解决方案后的最佳和最终解决方案。 Studio支持multidex,因为我们无法在一个dex中容纳超过65k的方法。