我不知道哪个gms,gcm版本适合我的项目
I don't know which gms, gcm version is suitable for my project
我是 运行 gcm 网络服务器,但它有超过 gcm 版本(以前的 firebase)
因此,引用旧项目并使用该项目的 gcm 依赖项。
我看到了这个问题:
但这对我不起作用。
我的 gradle 设置如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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'
})
implementation project(path: ':permissionchecker')
implementation project(path: ':datastateview')
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:support-vector-drawable:25.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-scalars:+'
implementation 'com.squareup.retrofit2:converter-gson:+'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.android.support:design:25+'
implementation 'com.android.support:support-v4:25+'
implementation 'com.android.support:recyclerview-v7:25+'
implementation 'br.com.simplepass:loading-button-android:+'
implementation 'com.googlecode.android-query:android-query:0.25.9'
implementation 'org.altbeacon:android-beacon-library:2.+'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
和root build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.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
}
我尝试了很多版本,但遇到了很多异常。
喜欢
java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in base.apk)
或
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
和其他人。
这是因为存在重复的依赖项。您不得使用 +
使用不准确的库版本。你不应该使用这个:
implementation 'com.android.support:design:25+'
因为这意味着你想获得最新版本的support library 25。因此,它将与:
implementation 'com.android.support:design:25.4.0'
使用 appcompat-v7 和 support-v4 隐式支持设计。所以,上面的代码是一样的:
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
最后,您的支持库依赖项将是:
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:support-vector-drawable:25.1.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
这显然是重复的。
您需要check if you have another duplicated libraries:
gradle -q dependencies your-app-project:dependencies
将 your-app-project
更改为您的模块名称,例如 app
。
我是 运行 gcm 网络服务器,但它有超过 gcm 版本(以前的 firebase)
因此,引用旧项目并使用该项目的 gcm 依赖项。
我看到了这个问题:
但这对我不起作用。
我的 gradle 设置如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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'
})
implementation project(path: ':permissionchecker')
implementation project(path: ':datastateview')
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:support-vector-drawable:25.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-scalars:+'
implementation 'com.squareup.retrofit2:converter-gson:+'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.android.support:design:25+'
implementation 'com.android.support:support-v4:25+'
implementation 'com.android.support:recyclerview-v7:25+'
implementation 'br.com.simplepass:loading-button-android:+'
implementation 'com.googlecode.android-query:android-query:0.25.9'
implementation 'org.altbeacon:android-beacon-library:2.+'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
和root build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.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
}
我尝试了很多版本,但遇到了很多异常。 喜欢
java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in base.apk)
或
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
和其他人。
这是因为存在重复的依赖项。您不得使用 +
使用不准确的库版本。你不应该使用这个:
implementation 'com.android.support:design:25+'
因为这意味着你想获得最新版本的support library 25。因此,它将与:
implementation 'com.android.support:design:25.4.0'
使用 appcompat-v7 和 support-v4 隐式支持设计。所以,上面的代码是一样的:
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
最后,您的支持库依赖项将是:
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:support-vector-drawable:25.1.0'
implementation 'com.android.support:design:25.4.0'
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
这显然是重复的。
您需要check if you have another duplicated libraries:
gradle -q dependencies your-app-project:dependencies
将 your-app-project
更改为您的模块名称,例如 app
。