Android Studio Pre Dexing失败了

Fra*_*ank 6 android actionbarsherlock android-studio

我正在尝试从Intellij Idea 12切换到Android Studio 0.2.1目前我的android项目是使用maven-android-plugin设置的.我使用actionbarsherlock作为apklib依赖项.

当我尝试使用Android Studio构建项目时,它在预处理阶段失败了

Error:Android Pre Dex: [xpp3-1.1.4c.jar] trouble processing "javax/xml/namespace/QName.class":
Error:Android Pre Dex: [xpp3-1.1.4c.jar] Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:Android Pre Dex: [xpp3-1.1.4c.jar] when not building a core library.
Error:Android Pre Dex: [xpp3-1.1.4c.jar] This is often due to inadvertently including a core library file
Error:Android Pre Dex: [xpp3-1.1.4c.jar] in your application's project, when using an IDE (such as
Error:Android Pre Dex: [xpp3-1.1.4c.jar] Eclipse). If you are sure you're not intentionally defining a
Error:Android Pre Dex: [xpp3-1.1.4c.jar] core class, then this is the most likely explanation of what's
Error:Android Pre Dex: [xpp3-1.1.4c.jar] going on.
Run Code Online (Sandbox Code Playgroud)

但是,对xpp3的唯一依赖是来自actionbarsherlock,如果你查看项目结构,你会看到它具有"提供"范围.所以在我看来,这不应该预先设定或包含在apk中.

你有类似的观察吗?或者你有一个android-maven项目与actionbarsherlock依赖在android工作室中构建?关于如何使用android studio的任何提示都很受欢迎:)

问候弗兰克

Fra*_*ank 11

我发现了这个问题.它与android studio或actionbar sherlock无关,但与另一个错误地声明具有xpp3和xmlParserApis依赖关系的apklib依赖关系,范围为"compile",应该"提供".

Idea 12对此没有任何问题,但android studio/idea 13预览似乎更严格.

只需将范围更改为项目结构中的"提供"即可解决问题.


mac*_*lir 0

我有同样的问题。这个结构最终对我有用:

\n\n

将 ABS 复制到项目中:

\n\n
Project\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 build.gradle\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Module\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 build.gradle\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libs\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libraries\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ABS\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 build.gradle\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libraries\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 libs\n\xe2\x94\x82\xc2\xa0\xc2\xa0     \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 src\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 settings.gradle\n
Run Code Online (Sandbox Code Playgroud)\n\n

项目/settings.gradle:

\n\n
include \':Module\', \':libraries:ABS\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

项目/库/ABS/build.gradle:

\n\n
buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath \'com.android.tools.build:gradle:0.5.+\'\n    }\n}\napply plugin: \'android-library\'\n\ndependencies {\n    compile "com.android.support:support-v4:13.0.0"\n}\n\nandroid {\n    compileSdkVersion 17\n    buildToolsVersion "17.0.0"\n\n    defaultConfig {\n        minSdkVersion 9\n        targetSdkVersion 17\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

项目/模块/build.gradle:

\n\n
buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath \'com.android.tools.build:gradle:0.5.+\'\n    }\n}\napply plugin: \'android\'\n\ndependencies {\n    compile "com.android.support:support-v4:13.0.0"\n    compile project(\':libraries:ABS\')\n}\n...\n
Run Code Online (Sandbox Code Playgroud)\n