本文共 6416 字,大约阅读时间需要 21 分钟。
右键-->ExportAndroid/Generate Gradle build files-->
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
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'.> Unable to delete directory: E:\AndroidStudioProjects\testApp\XXXX\build\intermediates\exploded-aar\testApp.Android-PullToRefresh\library\unspecified\res\drawable-mdpi-v4
解决办法:关闭编辑器重启即可
.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
解决办法:
原因: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/