轉載地址:http://4259297.blog.51cto.com/4249297/1700031
gradle build的時候出現的問題:
Error:Execution failed for task ':app:packageDebug'. Duplicate files copied in APK META-INF/notice.txt
解決辦法:
http://stackoverflow.com/questions/22467127/error-duplicate-files-during-packaging-of-apk
有時候gradle中途突然死機也會導致module不識別,刪除工程的build文件夾重新run即可(!!!)
android studio設置啟動時不自動打開上次關閉的項目
打開配置頁在搜索欄中輸入 system 點擊System Settings 將紅框內的勾選(reopen
last project on start up)去掉
###
AndroidStudio怎麽關聯SVN?
http://www.it165.net/pro/html/201404/11412.html
####
android studio gradle自動簽名構建實現
http://www.tuicool.com/articles/MjqYbiu
安裝studio出現的問題,tools.jar有問題。
http://jingyan.baidu.com/article/fd8044fad120ce5031137a2c.html
使用Android Studio打Andorid apk包的流程,andoridapk
http://www.bkjia.com/Androidjc/985056.html
關於Android studio打包發布,以及Android簽名的獲取
http://www.bubuko.com/infodetail-918228.html
Android App的簽名打包(晉級篇)
http://blog.csdn.net/dawanganban/article/details/11794767
Android Studio實現代碼混淆
http://www.bubuko.com/infodetail-987756.html
1.Android studio 無法創建Android項目 根本就沒有這個選項
解決辦法: http://zhidao.baidu.com/link?url=aexRXQ822IapdnQ2j3zaqcEgiGKtqrbFYii1Z7FtaqOBK6TqjgivaV4qqDTdf6ooMU71F3y-HKTnbvI2_p2JN3RwC7bIf669w4K5_6fb7bC
因為android support沒有勾選
2.Android studio 工具欄不小心隱藏了
View然後Toolsbar打勾就好了。
Android Studio底邊欄選項不見了,***何調出來
http://blog.csdn.net/hyr83960944/article/details/38067785
3.moudle被刪除了,怎麽恢復?
解決辦法:http://blog.csdn.net/hyr83960944/article/details/37520941
在project 的setting文件裏include ':moudle名'
4.怎麽導入jar包
第一步:切換成“project"模式,方能看見libs目錄。
第二步:將jar包拖入libs目錄,1.2的as直接復制是不行的。
第三步:打開工程所在Project Structure,然後選擇Dependencies,點擊那個加號選擇File Dependency ,然後再
Libs文件夾中選擇要導入的jar包。
兩外還有一種方法是在project選中jar包點擊右鍵"Add as library",這種方法需要定位到項目的根目錄,即
build.gradle所在的目錄。
dependencies
{
compile files('libs/android-support-v4.jar')
compile files('libs/xxxx.jar')
}
2種方法,最終都是在module的build.gradle文件裏dependencies結點多了這樣一句話compile files('libs/xxxx.jar')
5.導入的項目之後,發現很多快捷鍵、包括ctrl點擊跳轉都不行了
路徑有中文,我的問題就就是這個。
可能你會疑問,為什麽我之前的項目有中文沒有問題,這個我也解釋不清楚。
6.在AS中打開DDMS窗口
方式1:工具欄小機器人圖標
方式2:菜單欄Tool-Android-Android Device Manager
打開後發現,***面和Eclipse裏的DDMS差不多
7.使用adb命令
在window還是as內部的命令行,都提示***下錯誤
adb server is out of date. killing...
解決辦法: http://visualgdb.com/adbfix/
未解決問題!
8.使用Genymotion調試出現錯誤INSTALL_FAILED_CPU_ABI_INCOMPATIBLE解決辦法
http://blog.csdn.net/wjr2012/article/details/16359113
未解決問題!
9.怎麽 復制全類名
選中類名,右擊 快捷鍵ctrl+alt+shift+c
10.怎麽給Logcat添加過濾器
11.Android Studio 抽取style屬性的功能不好使怎麽辦?
網上找了很多資源,都不行,靈機一動,可以借助Eclipse來完成.
12.Android Studio中***何添加庫?
http://www.oschina.net/question/921036_154257?sort=time
向基於Android Studio構建的項目中導入開源庫
http://mobile.51cto.com/aprogram-464018.htm
13.Android studio***何導入已有的eclipse工程
http://my.oschina.net/cheneywangc/blog/192381
http://www.newasp.net/tech/73673.html
在導入已經生成了build.gradle文件的Eclipse項目,可能會出現***下錯誤:
could not install gradle distribution from consult ide for
可能還會提示什麽SDK路徑找不到的錯誤,那麽可能SDK的環境變量ANDROID_HOME沒有配。
14.Android Studio系列-簽名打包
http://blog.csdn.net/wwj_748/article/details/44622343
-
生成jks簽名文件 http://www.open-open.com/lib/view/open1441896025274.html
15.怎麽修改項目的編碼
16.怎麽創建Java項目
運行main函數 選中有main的類,ctrl _ shift + f10
註意一點,不要錯誤的使用菜單上的run方法
結束程序的運行,***果程序裏有個死循環的話,比***socket連接會一直占用著端口,要關閉。
17.Android Studio代碼自動提示無效(not available in Power Save mode)
http://blog.csdn.net/hyr83960944/article/details/40024439
18.自動生成構造方法和getter、setter等
快捷鍵 alt + insert(PgDn)
19.在Android Studio中為jar添加source源碼
http://www.bkjia.com/Androidjc/918926.html
20.假***想要看看有沒有某個快捷鍵實現自己的功能
21.json串換行展示
22.android studio 識別不到 genymotion device
http://blog.csdn.net/wuyuxing24/article/details/45169991
23.【Android Studio快捷鍵】之導入相應包聲明(import packages)
http://blog.csdn.net/hyr83960944/article/details/38438355
24.Android查看類的源碼的實現都是拋出異常
按照右上角的提示,下載對應sdk-platform的源碼即可,不需要翻墻。
25.Android Studio使用Lint進行代碼檢查
http://www.bubuko.com/infodetail-1055648.html
26.Android Studio導入項目的中文註釋亂碼解決方法
http://jingyan.baidu.com/article/37bce2be7337af1003f3a241.html
27.從自己導入別人的gradle項目出現的問題:
從svn上down下代碼的時候,打開android目錄什麽也沒有,也沒有mouble:
看EventLog提示,gradle一下,還有可能是要升級AS了。
28.Android Studio項目關閉之後重新打開發現Project目錄可以顯示,但是Android目錄什麽也沒有。
clean、rebuild,然後還是不行,於是查看一下項目目錄,發現在項目同級目錄下生成了一個.idea文
件,刪除它重新打開項目就好了。
29.Android Studio利用Gradle刪除沒有使用到的資源文件
http://www.mamicode.com/info-detail-594355.html
30.在.gradle裏compile的庫突然can't resolve了
去官方網站,compile最新的鏈接。
31.android studio升級,打開原來的項目,提示: Error:Failed to create directory 'C:\Users\Zhang\.gradle\caches\2.4\scripts\ijinit2_ejtybjqv7774bve37wtrho5a5\InitScript\initscript\classes'
同步一下工程就好了
32.簽名步驟:
註意alias不是隨便輸入的,右擊選框進去可以自動生成,當然手動輸入正確也行。
否則會報這個錯誤:
Failed to read key from keystore
33.怎樣查看Android Studio的Gradle版本、Gradle插件的版本。
http://jingyan.baidu.com/article/cbcede0710f49802f50b4d78.html
http://www.zhihu.com/question/24648316
34.怎麽在Android studio清除緩存
經常會出現關機會自動解決一些bug,應該是緩存的問題。
http://jingyan.baidu.com/article/7e4409533f4c092fc0e2efde.html
35.安裝配置gradle
http://www.th7.cn/Program/Android/201502/388733.shtml
http://my.oschina.net/u/1471093/blog/341990
36.使用Android studio Gradle 實現友盟多渠道打包
http://bbs.umeng.com/thread-9119-1-1.html
Gradle 多渠道打包的使用和錯誤分析
http://www.daxueit.com/article/7515.html
Android studio 使用心得(五)—代碼混淆和破解apk
http://www.bubuko.com/infodetail-1008755.html
http://www.jianshu.com/p/ec5178fbd838 (多種多渠道打包的方式)
37.Android代碼混淆之混淆規則
http://www.mincoder.com/article/4645.shtml
http://my.oschina.net/sammy1990/blog/271306
38。Android Studio編譯OsmAnd出現警告:GeoPointParserUtil.java使用或覆蓋了已過時的 API。有關詳細信息請使用-Xlint:deprecation重新編譯
http://www.crifan.com/android_studio_build_osmand_warning_use_deprecated_api_for_detail_use_xlint_deprecation_rebuild/
38。Android Studio的Project左邊欄不顯示
http://blog.csdn.net/hyr83960944/article/details/35986931
39.Android問題集錦之三十七:No resource found 'Theme.AppCompat.Light.DarkActionBar'
http://blog.csdn.net/lincyang/article/details/45394835
原因是gradle版本不對,將project的gradle由之前的1.5.0修改到1.3.0就好了。
dependencies { classpath }
40.Android Studio強制關機之後重新打開工程Error一大片
File-Invalid caches and restart即可解決問題。
41.引用新的自定義控件時,提示控件的一個屬性已經定義。但是又找不到在哪裏定義的,刪除吧,又報錯,只能修改屬性名字了。
42.工程的Menifest文件中定義的minSDK比依賴庫中的Menifest中的minsdk還要小的問題
將依賴moudle的改小或者按照提示的來。
43.導入工程出現的異常:
Gradle version 2.10 is required. Current version is 2.8 Error
解決辦法:
http://stackoverflow.com/questions/35153112/gradle-version-2-10-is-required-current-version-is-2-8-error
44。run項目出現的異常:
Android Gradle 編譯錯誤Java finished with non-zero exit value 2
解決辦法:
http://www.jianshu.com/p/4768fe43079a
http://my.oschina.net/polarw/blog/494046?p={{page}}
45.指定source(如jni)等的路徑
http://www.lai18.com/content/2446276.html
46.Android Studio中的.9圖在build的時候,沒有了黑線。
解決辦法:項目的build.gradle版本有問題。修改為高版本即可。
46-1.關於.9圖的一個錯誤AAPT。。。
在gradle裏加入
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
47.關於AppCompat的一個異常:
解決辦法:http://www.it1352.com/95268.html
這個問題的根本原因是style適配的問題,styles,styles-v21,定義了一個子theme,但是styles
裏沒有定義。
48. java.lang.NoClassDefFoundError:android.support.v7.internal.widget.TintManager
解決辦法:http://stackoverflow.com/questions/34015427/fatal-exception-main-java-lang-noclassdeffounderror-android-support-v7-interna
TabLayout屬於design庫裏的組件,但是design庫與appcompat庫不一致,設成一致就好了。
49.“URI is not registered”? Menifest的 DTD Schema約束全部失效了
解決辦法:原來是Menifest裏strings資源文件沒有從服務上搞下來,其實上面的錯誤是在build裏的,應該到源文件裏去看。
50. AndroidStudio build的時候那些坑
http://www.cnblogs.com/bjzhanghao/p/4892195.html
51. Error:Gradle version 1.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in /Users/username/apps/android/project-android/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip.
問題及解決辦法:我的情況的工程的gradle文件夾不小心刪除了,去另外工程復制一個過來就行了。
52.No resource identifier found for attribute 'backgroundSelector' in package 'com.btsj.hpx'
老是去build裏說不到之前刪除的庫,到src下去看,發現原來xml雖然沒有被引用,但是它還是引用 了之前刪除的庫。
53.Android Studio - Issue in build.gradle uncaught translation error ExecutionException OutOfMemory
To run dex in process, the Gradle daemon needs a larger heap.
http://stackoverflow.com/questions/33787030/android-studio-issue-in-build-gradle-uncaught-translation-error-executionexcep
在android閉包裏添加
dexOptions { javaMaxHeapSize "4g"}
54.java.util.zip.ZipException: duplicate entry
jar包重復了,仔細檢查一下。
如果有重復內容的2個jar包都要使用,或者jar包無法判斷是哪個jar包,可以采用下面的方法:
http://blog.csdn.net/u013220174/article/details/48004689
5.0以上手機貌似比65535的限制要大。
55.android studio修改包名
http://www.cnblogs.com/Kyouhui/p/4632813.html
註意要修改2處地方,一是java類的包名,二是build.gradle裏的applicationId。如果applicationId沒有變,桌面圖標會一直顯示復制的那個應用的圖標。
56.在對一些第3方的jar進行操作之後,某些第3方的jar包竟然編譯不了,不管clean rebuild還是關機重啟都沒有作用
最後將工作空間復制一分,說找找問題,竟然奇跡一般的好了。
57.Android Studio 出現 Gradle's dependency cache may be corrupt 錯誤分析
build到一半被打斷的時候就容易出現這個問題
刪除掉C盤裏的.gradle和.android就可以了
http://www.cnblogs.com/wanqieddy/p/4350708.html
58.修改gradle目錄
http://my.oschina.net/moziqi/blog/373141?p=1
59.Android Studio中使應用全屏無標題的方法(老方法好像不能用了)
http://www.68idc.cn/help/buildlang/ask/20150405310910.html
60.由於build.gradle 裏的 buildToolsVersion引發的一塊風波
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\android\jdk1.7.0_10\bin\java.exe'' finished with non-zero exit value 1
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 4096 MB.
To do this set org.gradle.jvmargs=-Xmx4096M in the project gradle.properties.
由於android studio更新了,新建的module的buildToolsVersion太高!
61.
Error:Application and test application id cannot be the same: both are 'com.ljfbest.demo' for debugAndroidTest
在build.gradle改成不一樣
62.
Android Studio - Execution failed for task ':app:transformClassesWithDexForDebug' - java.exe finished with non-zero exit value 2
解決辦法:jar包重復,http://zhidao.baidu.com/link?url=QudqUKAvdSByXxCsbbYYGkyORtCo5vacC5DgM2Lk0_4Q1etzUpKvOprvZZJpZvlLY19y9uSQvIM7CXOXjgJWsGCgw08OfDpzipJ0uvB5AB3
63.打開項目中文亂碼:
http://jingyan.baidu.com/article/37bce2be7337af1003f3a241.html
64.Error:Configuration with name 'default' not found.
工程裏有多個Module,其中一個Module缺少了build.gradle文件導致的如上報錯。
65.com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt
com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE.txt
解決辦法:註意NOTICE和LICENCE後面要有後綴名,和錯誤提示中的一致。
android{
....
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
...
}
66.finished with non-zero exit value 2
http://www.myexception.cn/android/2010267.html
我用的android studio打開的eclipse項目,且Eclipse本身是有依賴庫的。然後才發現主工程與依賴庫的jar包沖突了。
77. Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
引用了依賴庫,且依賴庫的包名沒有改正確,而且依賴庫裏有values-11這個文件夾,裏面的style貌似與主工程裏的style相同,導致了錯誤,刪除掉就好了。
78.依賴庫莫名的死活找不到,clean rebuild都不行。
將依賴庫註釋掉,clean,然後解開註釋,再次clean就能解決問題。但事先要確保不是代碼的問題。
79.
錯誤如下:
To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
應該大概是需要更大的內存才能跑起來吧
1.首先在build文件加上dexOptions {javaMaxHeapSize "2g"}
[html] view plain copy- android {
- compileSdkVersion 23
- buildToolsVersion "23.0.2"
- aaptOptions { cruncherEnabled = false }
- ...
- dexOptions {
- javaMaxHeapSize "2g"
- }
- }
2.上面錯誤中叫你在gradle.properties中設置org.gradle.jvmargs=-Xmx2048M,因此
[html] view plain copy
- # Project-wide Gradle settings.
- # IDE (e.g. Android Studio) users:
- # Gradle settings configured through the IDE *will override*
- # any settings specified in this file.
- # For more details on how to configure your build environment visit
- # http://www.gradle.org/docs/current/userguide/build_environment.html
- # Specifies the JVM arguments used for the daemon process.
- # The setting is particularly useful for tweaking memory settings.
- # Default value: -Xmx10248m -XX:MaxPermSize=256m
- # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
- # When configured, Gradle will run in incubating parallel mode.
- # This option should only be used with decoupled projects. More details, visit
- # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
- # org.gradle.parallel=true
- # org.gradle.jvmargs=-Xmx2048m
如果以上都不能解決,也可能是引用了多個librares文件,可以添加multiDexEnabled true解決。
defaultConfig {
.....
multiDexEnabled true
}
Tags: Android Andorid system failed files
文章來源: