1. 程式人生 > >在使用AS的過程中遇到的問題及解決辦法

在使用AS的過程中遇到的問題及解決辦法

1.3.0版本android.enableAapt2報錯

gradle.properties檔案下新增以下程式碼:

android.enableAapt2=false

androidTestCompile('com.android.support:support-annotations:26.1.0') {       force = true   } 

2.。我選擇的執行裝置的Android版本(deviceSdk),不符合(低於)我工程的編譯設定中的最低Android版本要求(minSdk)。

解決辦法是:在不影響執行功能的情況下,降低編譯設定中的版本號。

具體步驟為:

1,在app的build.gradle中,將android程式碼塊裡面的minSdkVersion改成19或者小於19即可;

2,然後進行Sync Now;

再執行就ok了。

(但是如果要執行的功能在低版本中未提供,降低編譯版本設定後可能編譯不過,那可能就得換個高版本的Android終端了吧,請自行嘗試此情況。)

錯誤:Execution failed for task ':app:preDebugAndroidTestBuild'. > Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

APP檔案中 dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])     implementation 'com.android.support:appcompat-v7:26.1.0'     implementation 'com.android.support.constraint:constraint-layout:1.0.2'                  //原為1.1.2     testImplementation 'junit:junit:4.12'     androidTestImplementation 'com.android.support.test:runner:1.0.2'     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

Error:Execution failed for task ':app:preDebugAndroidTestBuild'. > Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details. }

解決方法:在dependencies中增加: androidTestCompile('com.android.support:support-annotations:26.1.0') {       force = true   }