博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何将ADT项目导入Android studio及常見問題
阅读量:6415 次
发布时间:2019-06-23

本文共 6416 字,大约阅读时间需要 21 分钟。

  • ADT导出Android studio项目

 

右键-->ExportAndroid/Generate Gradle build files-->

 

  

  

  

  • Android studio导入项目

File-->Open File Or Project选择相应的项目即可

 

  

  • 常见问题

  Error:Configuration with name 'default' not found.

settings.gradle中include的库找不到

  解决Gradle DSL method not found: ‘android()’

  

删掉最外层的build.gradle中的android {    compileSdkVersion 19    buildToolsVersion '21.1.1'}然后重新刷新就ok了

  参考:http://www.hloong.com/?p=100

  

  解决png图片libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

  

AAPT err(Facade for 702915749): E:\AndroidStudioProjects\testApp\XXXX\build\intermediates\exploded-aar\testApp.Android-PullToRefresh\library\unspecified\res\drawable-mdpi-v4\default_ptr_flip.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedAAPT err(Facade for 702915749): E:\AndroidStudioProjects\testApp\XXXX\build\intermediates\exploded-aar\testApp.Android-PullToRefresh\library\unspecified\res\drawable-xhdpi-v4\default_ptr_flip.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedAAPT err(Facade for 702915749): ERROR: 9-patch image E:\AndroidStudioProjects\testApp\XXXX\res\drawable-hdpi\mini_btn_cancel_bg.9.png malformed.AAPT err(Facade for 702915749):        Frame pixels must be either solid or transparent (not intermediate alphas).AAPT err(Facade for 702915749):        Found at pixel #4 along top edge.AAPT err(Facade for 121617349): E:\AndroidStudioProjects\testApp\XXXX\res\drawable-hdpi\title_bar_menu_on.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedAAPT err(Facade for 121617349): ERROR: 9-patch image E:\AndroidStudioProjects\testApp\XXXX\res\drawable-hdpi\mini_btn_confirm_bg.9.png malformed.AAPT err(Facade for 121617349):        Frame pixels must be either solid or transparent (not intermediate alphas).AAPT err(Facade for 121617349):        Found at pixel #4 along top edge.AAPT err(Facade for 121617349): E:\AndroidStudioProjects\testApp\XXXX\res\drawable-hdpi\title_bar_menu.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedAAPT err(Facade for 1675937883): E:\AndroidStudioProjects\testApp\XXXX\build\intermediates\exploded-aar\testApp.Android-PullToRefresh\library\unspecified\res\drawable-hdpi-v4\default_ptr_flip.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedAAPT err(Facade for 1675937883): E:\AndroidStudioProjects\testApp\XXXX\res\drawable-hdpi\loading.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been editedError:Execution failed for task ':XXXX:mergeDebugResources'.> Some file crunching failed, see logs for details

  解决办法:下载imagemagick并安装,执行如下语句

set fn=E:\Program Files\ImageMagick-6.9.0-Q16\convert.exefor /f "tokens=*" %%i in ('dir/s/b *.png') do "%fn%" "%%i" -strip "%%i"

 解决Error:Execution failed for task ':XXXX:clean'.

Error:Execution failed for task ':XXXX:clean'.> Unable to delete directory: E:\AndroidStudioProjects\testApp\XXXX\build\intermediates\exploded-aar\testApp.Android-PullToRefresh\library\unspecified\res\drawable-mdpi-v4

  解决办法:关闭编辑器重启即可

 AAPT err(Facade for 1984292802): ERROR: 9-patch image xxxxx.9.png malformed.

  .9图片没有指定大小。

  android studio中编辑并保存即可。

 

 编译器版本不对

Error:(401, 25) 错误: 找不到符号符号:   方法 sqrt(float)位置: 类 FloatMathError:(12, 23) 错误: 程序包org.apache.http不存在Error:(13, 23) 错误: 程序包org.apache.http不存在Error:(14, 30) 错误: 程序包org.apache.http.client不存在Error:(15, 37) 错误: 程序包org.apache.http.client.entity不存在Error:(16, 38) 错误: 程序包org.apache.http.client.methods不存在Error:(17, 38) 错误: 程序包org.apache.http.client.methods不存在Error:(18, 35) 错误: 程序包org.apache.http.impl.client不存在Error:(19, 31) 错误: 程序包org.apache.http.message不存在Error:(21, 28) 错误: 程序包org.apache.http.util不存在Error:(38, 16) 错误: 找不到符号符号:   类 HttpClient位置: 类 HttpUtilError:(38, 44) 错误: 找不到符号符号:   类 DefaultHttpClient位置: 类 HttpUtilError:(67, 5) 错误: 找不到符号符号: 类 HttpGetError:(67, 23) 错误: 找不到符号符号: 类 HttpGetError:(69, 5) 错误: 找不到符号符号: 类 HttpResponseError:(74, 22) 错误: 找不到符号符号: 变量 EntityUtilsError:(100, 5) 错误: 找不到符号符号: 类 HttpPostError:(100, 25) 错误: 找不到符号符号: 类 HttpPostError:(103, 10) 错误: 找不到符号符号: 类 NameValuePairError:(103, 48) 错误: 找不到符号符号: 类 NameValuePairError:(107, 21) 错误: 找不到符号符号: 类 BasicNameValuePairError:(110, 24) 错误: 找不到符号符号: 类 UrlEncodedFormEntityError:(113, 5) 错误: 找不到符号符号: 类 HttpResponseError:(118, 22) 错误: 找不到符号符号: 变量 EntityUtils注: 某些输入文件使用或覆盖了已过时的 API。注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

  解决办法:项目-->右键-->Open Module Settings

  

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

  Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:22:5-83:19 to override.

  解决办法:

原因:AS的Gradle插件默认会启用Manifest Merger Tool,若Library项目中也定义了与主项目相同的属性(例如默认生成的android:icon和android:theme),则此时会合并失败,并报上面的错误。解决方法有以下2种:方法1:在Manifest.xml的application标签下添加tools:replace=”android:icon, android:theme”(多个属性用,隔开,并且记住在manifest根标签上加入xmlns:tools=”http://schemas.android.com/tools”,否则会找不到namespace哦)方法2:在build.gradle根标签上加上useOldManifestMerger true (懒人方法)参考官方介绍:http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

  java.lang.IllegalArgumentException: already added: Landroid/support/v4/hardware/display/DisplayManagerCompat;

去掉lib下的support-v4.jardependencies下添加依赖:compile 'com.android.support:support-v4:13.0.0'

  com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE.txt

  File1: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\commons-net-3.1.jar    File2: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\commons-httpclient-3.1.jar    File3: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\commons-io-2.4.jar    File4: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\commons-codec-1.6.jar    File5: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\commons-logging-1.1.3.jar    File6: E:\AndroidStudioProjects\YHSoftEbook\YHSoftEbook\libs\fastjson-1.2.2.jar

  解决办法:在主工程下的添加packagingOptions

android {    packagingOptions {         exclude 'META-INF/DEPENDENCIES.txt'         exclude 'META-INF/LICENSE.txt'         exclude 'META-INF/NOTICE.txt'         exclude 'META-INF/NOTICE'         exclude 'META-INF/LICENSE'          exclude 'META-INF/DEPENDENCIES'          exclude 'META-INF/notice.txt'          exclude 'META-INF/license.txt'          exclude 'META-INF/dependencies.txt'          exclude 'META-INF/LGPL2.1'      }  }  

 

转载地址:http://bacra.baihongyu.com/

你可能感兴趣的文章
GNU make manual 翻译( 一百四十五)
查看>>
重构之美-走在Web标准化设计的路上[复杂表单]3 9 Update
查看>>
linux中的优先搜索树的实现--prio_tree【转】
查看>>
转载: 打造自己的asp.net验证控件
查看>>
重构之美-跨越Web标准,触碰语义网[开门见山:Microformat]
查看>>
git入门与实践【转】
查看>>
WPF 虚拟键盘
查看>>
储存卡无法打开专家教您怎么数据恢复
查看>>
彼得原理
查看>>
如何利用【百度地图API】,制作房产酒店地图?(下)——结合自己的数据库...
查看>>
[20171113]修改表结构删除列相关问题3.txt
查看>>
特征选择
查看>>
在Winform程序中设置管理员权限及为用户组添加写入权限
查看>>
RTMP直播到FMS中的AAC音频直播
查看>>
多能互补提速 加快我国能源转型和现代能源体系建设
查看>>
《JavaScript设计模式》——2.5 多种调用方式——多态
查看>>
Redis开发运维实践高可用和集群架构与实践(二)
查看>>
程序员的常见“谎话”:对,这是一个已知 Bug
查看>>
如何侦查SQL执行状态
查看>>
CentOS 7 命令行如何连接无线网络
查看>>