不生成apk
Don't generate apk
请帮帮我。
无法创建 apk。该应用程序在模拟器中运行。
也许您需要在 gradle 中做点什么?
Build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.shcherbuk96.example2firebase"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.firebaseui:firebase-ui-auth:0.6.2'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
错误:
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Error:com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Error:java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
我改变:
enter image description here
问题出在 gradle
文件中,而不是清单中。
所有 firebase 和支持库应该是同一版本。检查它并将它们设置为保存版本。
您应该更新您的 firebase 依赖项:
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
另外添加以下内容(如果您还没有添加的话):
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
P.S: 尽量不要在包名中使用 example
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
这意味着您要添加相同的 class 两次(不同版本)。
发生这种情况是因为您正在使用 FirebaseUI。
每个版本的 FirebaseUI 都依赖于固定版本的 firebase 库。
为方便起见,这里有一些例子:
FirebaseUI Version Firebase/Play Services Version
1.2.0 10.2.0
1.1.1 10.0.0 or 10.0.1
1.0.1 10.0.0 or 10.0.1
1.0.0 9.8.0
0.6.2 9.8.0
0.6.1 9.6.1
0.6.0 9.6.0
然后你必须更改你的依赖项:
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
此外,如果您将项目升级到版本 1.x.x,则在将项目与 Gradle 同步时可能会遇到错误 Failed to resolve: com.twitter.sdk.android:twitter:2.x.x
。
版本 1.0.0 添加了一个新的必需配置步骤。
要解决此问题,您必须将 Fabric 存储库添加到您的存储库:
repositories {
// ...
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
请帮帮我。 无法创建 apk。该应用程序在模拟器中运行。
也许您需要在 gradle 中做点什么?
Build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.shcherbuk96.example2firebase"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.firebaseui:firebase-ui-auth:0.6.2'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
错误:
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Error:com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Error:java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
我改变: enter image description here
问题出在 gradle
文件中,而不是清单中。
所有 firebase 和支持库应该是同一版本。检查它并将它们设置为保存版本。
您应该更新您的 firebase 依赖项:
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
另外添加以下内容(如果您还没有添加的话):
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
P.S: 尽量不要在包名中使用 example
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
这意味着您要添加相同的 class 两次(不同版本)。
发生这种情况是因为您正在使用 FirebaseUI。
每个版本的 FirebaseUI 都依赖于固定版本的 firebase 库。
为方便起见,这里有一些例子:
FirebaseUI Version Firebase/Play Services Version
1.2.0 10.2.0
1.1.1 10.0.0 or 10.0.1
1.0.1 10.0.0 or 10.0.1
1.0.0 9.8.0
0.6.2 9.8.0
0.6.1 9.6.1
0.6.0 9.6.0
然后你必须更改你的依赖项:
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
此外,如果您将项目升级到版本 1.x.x,则在将项目与 Gradle 同步时可能会遇到错误 Failed to resolve: com.twitter.sdk.android:twitter:2.x.x
。
版本 1.0.0 添加了一个新的必需配置步骤。
要解决此问题,您必须将 Fabric 存储库添加到您的存储库:
repositories {
// ...
jcenter()
maven { url 'https://maven.fabric.io/public' }
}