您的位置:首页 > 移动开发 > Android开发

AndroidStudio 导入第三方类库

2016-01-26 12:03 656 查看
这个是我的个人经验:

仅供参考。

第一步:删掉第三方类库目录中的bin,gen两个文件夹;不然会导入不成功;应该会报下面的错误



删除之后,应该可以选择,导入到项目中,点击编译,应该会报错。

下面是对我遇到的两个错误,拿出来讲一下解决方式,仅供参考,如果有更好的方法,希望留言。

第二步:遇到错误:

Error:Execution failed for task ':app:processDebugManifest'.

> Manifest merger failed : Attribute application@icon value=(@drawable/aircall_logo) from AndroidManifest.xml:55:9-46

is also present at [Ihu2.0:zxingbar_lib:unspecified] AndroidManifest.xml:22:9-45 value=(@drawable/ic_launcher)

Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:50:5-395:19 to override

Errors while building APK. You can find the errors in the 'Messages' view.

大致意思是说,清单文件合并失败,因为两个项目中的清单文件都有android:icon属性,重复了,需要删除一个。

解决方案:将第三方类库的android:icon属性删除,保留app项目中的清单文件中的android:icon属性。

第三部:遇到错误:

Error:Execution failed for task ':app:processDebugResources'.

> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\android-sdk-windows-all\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

这个问题,应该是说:

(1)资源文件重复了,或者说,图片重复了。

(2)文件不存在,也会报这个错误;

一个典型的就是ic_launcher.png图片重复了,app项目和第三方类库中的图片重复了

解决方案(1):删除第三方类库中,与app项目重复的图片,同时,看看有没有其它的图片重复了

参考资料:http://stackoverflow.com/questions/29965398/gradle-finished-with-non-zero-exit-value-1-ic-launcher-png-error-duplicate-fi

上面的错误,还有一种可能,png文件的名称,取名有问题

解决方案(2):修改png文件名

参考资料:http://stackoverflow.com/questions/29763634/android-process-command-aapt-exe-finished-with-non-zero-exit-value
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: