2017-04-18 25 views
0

我是Android開發新手。我有Android Studio自帶的默認應用程序,它在屏幕上有一個標籤。當我嘗試運行仿真器的應用程序,我得到這些錯誤:Android - 檢索項目的父項時出錯

enter image description here

我搜索,然後更新我的SDK API到23級我gradle這個構建設置爲編譯23以及但是我得到這個錯誤,它不會運行。

enter image description here

+0

將appcompat版本更改爲25,例如'com.android.support:appcompat-v7:25.3.1' – azizbekian

+0

不,沒有工作。 – Waleed

回答

2

你編譯SDK版本必須支持庫的主要版本匹配。

使用compileSdkVersion 25

試試這個:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "your_id" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:support-v4:25.3.1' 
} 

編輯

對於SDK 23

compileSdkVersion 23 
buildToolsVersion "23.0.2" 
defaultConfig { 
    applicationId "your_id" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 

compile 'com.android.support:appcompat-v7:23.2.0' 
compile 'com.android.support:support-v4:23.2.0' 

的想法是使用同一版本

+0

我沒有API 25 – Waleed

+0

錯誤:原因:無法找到目標哈希字符串'android-25'在:F:\ Android \ android-sdk \ android-sdk Open Android SDK Manager Waleed

+0

你有沒有API 23?你也可以下載api 25 – rafsanahmad007

相關問題