解決:鏈接:http://stackoverflow.com/questions/33923461/how-do-i-resolve-duplicate-files-copied-in-apk-meta-inf
多個文件拉取沖突,那個沖突排除哪個看調(diào)試報錯.
2.AndroidStudio導入新項目一直卡在Building gradle project info的解決解決方案:
隨便找一個你能運行的as項目胧辽,打開gradle-wrapper.properties峻仇,文件目錄:項目/gradle/wrapper/gradle-wrapper.properties票顾,復制distributionUrl這一整行的內(nèi)容帆调,eg:distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip奠骄,打開你要導入的項目的gradle-wrapper.properties番刊,具體步驟與步驟2相同,把步驟3復制的內(nèi)容芹务,替換你要導入的項目的gradle-wrapper.properties文件的distributionUrl這一行蝉绷,再重啟as,導入項目就可以了
Android開發(fā)中可以使用Style來為大量相同的控件設置相同的屬性熔吗,減少代碼的重復辆床。
3.Comparator強行對某個對象collection進行整體排序的比較函數(shù)桅狠,可以將Comparator傳遞給Collections.sort: 針對list的某個對象排序
或Arrays.sort:針對 數(shù)組進行排序。
構造一個比較器:
public class ByOrderComparator implements Comparator {
@Override
public int compare(Statements lhs, Statements rhs) {
return lhs.getOrder()-rhs.getOrder();}
}
Collections.sort(list,new ByOrderComparator());
4.sourcetree上傳代碼的時候 中跌,先推送最新代碼咨堤,暫存漩符;然后拉取落后版本的代碼,再提交推送暫存嗜暴,最后兩次再次進行推送解決凸克,恢復正常闷沥。 當遇到無法解析git的地址問題的時候,關閉Wi-Fi狐赡,重新打開sourcestree即可解決撞鹉。
5.添加一個module的時候颖侄,可能出現(xiàn)gradle編譯不通過, 檢查看览祖,是否在build.gradle里面的classpath路徑是否沒添加 可以從要導入的module里的build.gradle文件里面 找到路徑孝鹊,加入現(xiàn)在項目的build.gradle展蒂。
6.引用自定義文件又活,控件的時候 锰悼,app屬性沒有自動導入,可以手動在最外層的XML文件中箕般,添加相關代碼:
xmlns:app="http://schemas.android.com/apk/res-auto"
7.真機調(diào)試的問題:
Installation error: INSTALL_CANCELED_BY_USER
//使用的是紅米note4耐薯, 進入手機的USB調(diào)試,有一個“USB安裝”按鈕体谒,把它打開就行了。
使用命令 adb uninstall com...(包名) 的時候
Failure [DELETE_FAILED_INTERNAL_ERROR]
查了下臼婆,說是要root
adb pull /sdcard/DCIM/Camera //拉取手機中的文件,注意路徑/sdcard
8.使用Genymotion調(diào)試出現(xiàn)錯誤INSTALL_FAILED_CPU_ABI_INCOMPATIBLE解決辦法
http://blog.csdn.net/wjr2012/article/details/16359113
下載完壓縮包颁褂,直接拖拽到模擬器即可评汰,點擊確定送粱,然后重啟模擬器即可解決無法安裝的問題。
9.問題:Error:(58) Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment
解決:
參考:http://blog.csdn.net/chniccs/article/details/51258972
android {
lintOptions {
checkReleaseBuilds false
}
}
10.問題:8.0手機無法安裝測試apk
解決:增加允許安裝權限
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
- android 3.0 無法編譯打包apk:Error:Failed to complete Gradle execution. Cause: The version of Gradle you are using (2.14.1) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.
解決:
參考:https://blog.csdn.net/dazhaodai/article/details/73730090
12.Android studio 3.0 編譯butterknife 失敵鹣洹:
解決:
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}