今天使用gradle對自己的工程進行打包,出現錯誤如下:
1) 出錯如下:
Failed to parse XML file: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
查詢後的錯誤爲 AndroidManifest.xml中出現了中文,主要把中文去除就可以了。
2)使用本地maven庫
repositories {
mavenLocal()
}
3.提示錯誤: 軟件包 android.support.v4.app 不存在
解決方法:
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
4.使用自定義的framework及第三方依賴
dependencies {
compile 'com.android.support:support-v4:13.0.0'
// compile group: '<group-id>',name:'<artifact-id>',version:'<version>'
//編譯使用二維碼的依賴
compile 'com.google.zxing:zxing:1.0.0'
//微信自定義的framwork依賴
compile 'com.weixin.test:framework:8.0-SNAPSHOT'
//第三方庫的依賴
compile 'com.tencent.mm.sdk.openapi:mm_sdk_openapi:2.0'
}
5. Gradle打包時出現編碼UTF-8的不可映射字符的問題
在build.gradle中最後一行添加如下代碼:
1 |
tasks.withType(Compile)
{ |
2 |
options.encoding
= "GBK" |
3 |
} |
6. 更新依賴:kxml2#kxml2;2.3.0 is relocated to net.sf.kxml#kxml2;2.3.0. Please update your dependencies.
maven中的配置如下:
kxml2下載地址: http://sourceforge.net/projects/kxml/files/kxml2/2.3.0/
7.出錯信息如下:
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/c
urrent/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "ownPartnerId" on "root project 'taobao'", value: " [Ljava.lang.String;@31...".
FAILURE: Build failed with an exception.
解決方法:
aidl.srcDirs = ['src'] 替換爲 aild.ext.srcDirs = ['src']