1驯嘱、Error:Could not find com.android.support:recyclerview-v7:23.4.0.
解決方法:
update from android studio: Help -> Check for Update... And Installed API level 23
2纪蜒、有時(shí)候從github Clone的項(xiàng)目在本地運(yùn)行會(huì)報(bào)如下錯(cuò)誤:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
>com.android.build.api.transform.TransformException: java.lang.RuntimeException:
com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command '
D:\ProgramTools\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
解決方法:
檢查自己原有(可運(yùn)行)項(xiàng)目build.gradle
中targetSdkVersion
是否與該項(xiàng)目的一致(Ctrl + shift + f :快速定位到項(xiàng)目的targetSdkVersion位置)缰儿。如果不一致的話改為原有項(xiàng)目的targetSdkVersion
挣饥。
參考:stackoverflow
3、Error:Gradle DSL method not found: ‘a(chǎn)ndroid()’
解決方法:
刪掉最外層的build.gradle中的
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
}
感謝:黃龍
參考:stackoverflow
4馒胆、
Error: Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features:{
windowActionBar: false,
windowActionBarOverlay: false,
android:windowIsFloating: false,
windowActionModeOverlay: false,
windowNoTitle: false
}
原因:style文件編寫錯(cuò)誤
<style name="AppTheme.Base" parent="Theme.AppCompat">
<item name="windowActionBar">false</item>
<!-- 使用 API Level 22 編譯的話热康,要拿掉前綴字 (android:): <item name=":windowNoTitle">true</item>-->
<item name="android:windowNoTitle">true</item>//報(bào)如上錯(cuò)誤應(yīng)去掉前綴android
</style>
5、Error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
本次bug的引入是因?yàn)樘砑恿藄tyle.xml (value 19) ,其Parent Theme與app 中theme.xml中的不一致耘拇,故撵颊,該bug只在android 4.4 上重現(xiàn)。
<resources>
<style name="AppTheme" parent="@style/AppBaseTheme"><!--<style name="AppBaseTheme" parent="android:Theme.Holo.Light">-->
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
6惫叛、Error: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016
出現(xiàn)該錯(cuò)誤時(shí)依賴版本:
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
ANDROID_BUILD_TOOLS_VERSION=23.0.2
解決方法:更新依賴版本至最新倡勇,均為24.2.0,ANDROID_BUILD_TOOLS_VERSION=23.0.3