0

APIレベル14でAndroidアプリケーションを作成しました。今度は、アプリケーション用のプッシュ通知を実装することにしました。 GCMはサポートされなくなったため、FCM以外の方法はありません。アンドロイドのドキュメントによると、FCMのMin SDKは14です。しかし、FCMの正しいクラスパスとコンパイルの依存関係は何か分かりません。現在、我々は、次を使用:APIレベル14のFirebaseクラウド依存性

は我々だけで、これらの問題を解決することができます...

Error:Gradle: Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: Failed to execute aapt 

E:\Projects\Android\Fcm\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml 
Error:(12, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. 
Error:(14, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. 

そして、このような多くのより多くのエラー:建物で

**App Level Gradle** 

    apply plugin: 'com.android.application' 
    android { 
    compileSdkVersion 14 
    buildToolsVersion "27.0.1" 
    defaultConfig { 
     applicationId "com.infotropy.fcm" 
     minSdkVersion 14 
     targetSdkVersion 26 
     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') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    testCompile 'junit:junit:4.12' 
    compile 'com.google.android.gms:play-services:9.2.1' 
    compile 'com.google.firebase:firebase-messaging:9.2.1' 
} 
    apply plugin: 'com.google.gms.google-services' 

**Project Level Gradle** 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.0' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

、我々はエラーを構築し、次しまいました依存関係を変更し、そうであれば正しい依存関係を述べてください。

非常に大きなプロジェクトであり、SDKのバージョンを変更すると、コードの変更や面倒な作業が発生することがあるので、最初にプロジェクトのSDKバージョンを変更したくないという点に注意してください。

答えて

0

あなたが使用しているので:

compileSdkVersion 27 

と最新:

compile 'com.google.android.gms:play-services:9.2.1' 
compile 'com.google.firebase:firebase-messaging:9.2.1' 

あなたは使用compileSdkVersion 14、あなたが使用する必要がありますしかしcompileSdkVersion 23

を使用することはできません安定版:

compile 'com.google.android.gms:play-services:11.6.2' 
compile 'com.google.firebase:firebase-messaging:11.6.2' 

そして最後に:返信用

buildscript { 
    // ... 
    dependencies { 
     // ... 
     classpath 'com.google.gms:google-services:3.1.1' // google-services plugin 
    } 
} 

allprojects { 
    // ... 
    repositories { 
     // ... 
     maven { 
      url "https://maven.google.com" // Google's Maven repository 
     } 
    } 
} 
+0

感謝。しかし私が述べたように、私たちはSDKのバージョンを変更したくありません。 APIレベル14でFCMを実装できませんか?公式のアンドロイドのドキュメントによると、API 14でそれを行うことはできますが、適切な依存関係は提供していません。 –

+0

api 14を使用してコンパイルすることはできません。 compileSdkとminSdkを混同しないでください。 27でコンパイルし、minSdk = 14を使用することができます。 –

+0

私は答えを更新しました。 9.2.1を使用する場合は、compileSdk = 23を使用する必要がありますが、これは古いバージョンを使用するのに良い方法ではないと思います。 –