Android的工作室 - 导入简单XML库 [英] Android Studio - Importing Simple-Xml library
问题描述
我要疯了我的Android Studio IDE中。
我愿意从中央(v2.7.1)
添加Maven的库简单的XML-
该项目编译好
-
摇篮有在lib依赖其
build.gradle
:相关性{ 编译com.android.support:appcompat-v7:18.0.0 编译org.simpleframework:简单的xml:2.7.1 }
-
导出在机器人工作室的模块设置为简单的XML lib中检查:
截图在这里:<一href="http://s6.postimg.org/xxgj56zkx/Module_Settings.png">http://s6.postimg.org/xxgj56zkx/Module_Settings.png
和我找不到上课的时候我跑我的应用程序...
java.lang.NoClassDefFoundError的:org.simpleframework.xml.core.Persister
我很失落,这听起来像摇篮不包的APK的lib和依赖某些原因....
任何想法???
EDIT1 :我的机器人工作室的版本是0.2.13(最新的),摇篮0.5 +
。EDIT2 :全build.gradle我用
buildscript { 库{ mavenCentral() } 依赖{ 类路径com.android.tools.build:gradle:0.5.+ } } 应用插件:'机器人' 库{ mavenCentral() } 安卓{ compileSdkVersion 17 buildToolsVersion17.0.0 defaultConfig { 的minSdkVersion 14 targetSdkVersion 18 } } 依赖{ 编译com.android.support:appcompat-v7:18.0.0 编译org.simpleframework:简单的xml:2.7.1 }
我发现这个问题。
这是graddle插件0.5 +如我所料。
而Android 0.3.0工作室与摇篮插件0.6 +(摇篮1.8),现在解决了这个问题。
不过,我做的是Android工作室0.2.13和摇篮插件0.5这样的方式来运行应用程序:
随着摇篮插件拒绝从行家中央部署该库,我下载了库和依赖我的项目的lib目录。 我安装工程中使用的库作为当地的一个在项目的lib目录下。
方向的解决方法:
-
删除我的项目,以简单的XML的所有引用(行家中心)的模块设置
-
复制简单的XML-2.7.1.jar,STAX-1.2.0.jar,STAX-API-1.0.1.jar和xpp3-1.1.3.3.jar到lib目录在我的项目
-
在我的项目选择的lib简单的XML-2.7.1.jar和导入使用添加为库上下文菜单中的lib
-
改变这样的build.gradle:
依赖{
编译com.android.support:appcompat-v7:18.0.0 编译的文件(简单的XML-2.7.1.jar)
}
注:不包括相关性,否则他们将创建Android系统冲突,mentionned由格热戈日
I am going crazy with my Android Studio IDE.
I am willing to add the Maven library simple-xml from Central (v2.7.1)
The project compiles well
Gradle has the lib dependency in its
build.gradle
:dependencies { compile 'com.android.support:appcompat-v7:18.0.0' compile 'org.simpleframework:simple-xml:2.7.1' }
Export is checked in Android Studio's Module Settings for the simple-xml lib:
Screenshot here: http://s6.postimg.org/xxgj56zkx/Module_Settings.png
And I got the Class not found when I run my app ...
java.lang.NoClassDefFoundError: org.simpleframework.xml.core.Persister
I am lost, It sounds like Gradle doesn't pack the lib and dependencies in the apk for some reasons ....
Any ideas ???
Edit1: my Android Studio version is 0.2.13 (latest), Gradle 0.5.+
Edit2: full build.gradle I use
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 17 buildToolsVersion "17.0.0" defaultConfig { minSdkVersion 14 targetSdkVersion 18 } } dependencies { compile 'com.android.support:appcompat-v7:18.0.0' compile 'org.simpleframework:simple-xml:2.7.1' }
I found the problem.
It was the graddle plugin 0.5.+ as I expected.
The Android Studio 0.3.0 with gradle plugin 0.6.+ (Gradle 1.8) now fixes the problem.
However, I made the application to work with the Android Studio 0.2.13 and gradle plugin 0.5 this way:
As the gradle plugin refuses to deploy the library from maven central, I downloaded the library and dependencies to the lib directory of my project. I setup the project to use the library as a local one in the lib directory of the project.
Directions for the workaround:
remove all references in my project to simple-xml (maven central) in Module Settings
Copy simple-xml-2.7.1.jar, stax-1.2.0.jar, stax-api-1.0.1.jar and xpp3-1.1.3.3.jar to lib directory in my project
Select the lib simple-xml-2.7.1.jar in my project and Import the lib using Add as Library contextual menu
Change the build.gradle like this:
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0' compile files('simple-xml-2.7.1.jar')
}
Note: do not include the dependencies, otherwise they will create conflicts with the Android system as mentionned by Grzegorz
这篇关于Android的工作室 - 导入简单XML库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!