4

API 23 では HttpClient がサポートされていないため、Android Studio の最小 SDK バージョンを API 23 から API 22 に変更したいと考えています。 targetSdkVersion を 23 から 22 に変更します。

android {
compileSdkVersion 23
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.test.gcmgreetingapp"
    minSdkVersion 11
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
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:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile project(':android-query-full.0.26.7')
compile 'com.loopj.android:android-async-http:1.4.8'
}

次に、プロジェクトを同期して再構築します。しかし、gradleコンソールで次のエラーが発生しました

AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:TextAppearance.Material.Widget.Button.Inverse\u0027.","sources":[{"file":"C:\\Users\\nischal.manandhar\\AndroidStudioProjects\\GCMGreetingApp\\app\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7\\23.0.0\\res\\values-v23\\values-v23.xml","position":{"startLine":1}}],"original":""}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:Widget.Material.Button.Colored\u0027.","sources":[{"file":"C:\\Users\\nischal.manandhar\\AndroidStudioProjects\\GCMGreetingApp\\app\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7\\23.0.0\\res\\values-v23\\values-v23.xml","position":{"startLine":1}}],"original":""}


FAILED

FAILURE: Build failed with an exception.

エラーはファイル v23\values-v23.xml にあります

どんな助けでも大歓迎です。ありがとう!!!

4

6 に答える 6

2
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "au.com.websutra.gcmgreetingapp"
    minSdkVersion 11
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
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:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile project(':android-query-full.0.26.7')
compile 'com.loopj.android:android-async-http:1.4.8'
}

注: フォルダー名を「values-v23」から「values-v22」に変更します。

于 2015-08-20T11:22:16.417 に答える
2

変更してみる

compile 'com.android.support:appcompat-v7:23.0.0'

compile 'com.android.support:appcompat-v7:22.2.0'

compileSdkVersion targetSdkVersionに設定してこれを行います22

于 2015-08-20T11:12:44.373 に答える
2

AndroidManifest.xmlで変更します

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />

乾杯

于 2015-08-20T11:04:28.283 に答える
1

いくつかの調査の後、org.apache.http.legacy.jar ライブラリを使用して、API 23 でも Apache HTTP クライアントが動作するようになりました。次の構成が機能しました。

android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
useLibrary 'org.apache.http.legacy'

defaultConfig {
    applicationId "com.test.gcmgreetingapp"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
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:23.0.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile project(':android-query-full.0.26.7')
compile 'com.loopj.android:android-async-http:1.4.8'
compile files('libs/org.apache.http.legacy.jar')
} 

org.apache.http.legacy.jarAndroid/Sdk/platforms/android-23/optionalフォルダーからプロジェクトの app/libsに手動でコピーし、追加しました

useLibrary 'org.apache.http.legacy'  

android{...} タグ内。

于 2015-08-21T11:35:07.997 に答える