我试着用android studio安装一个react-native应用程序,安装apk后应用程序就会停止。
以下是带有错误的logcat:
07-25 08:35:08.866 22185-22185/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-25 08:35:08.866 22185-22185/? E/android.os.Debug: failed to load memtrack module: -2
07-25 08:35:09.178 22201-22201/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-25 08:35:09.179 22201-22201/? E/android.os.Debug: failed to load memtrack module: -2
07-25 08:35:16.178 22266-22266/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-25 08:35:16.178 22266-22266/? E/android.os.Debug: failed to load memtrack module: -2
07-25 08:35:16.269 22278-22278/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.apply.debug, PID: 22278
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbo;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbo" on path: DexPathList[[zip file "/data/app/com.apply.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.apply.debug-2/lib/x86, /data/app/com.apply.debug-2/base.apk!/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.zzbo
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
bundleInStaging: true, // Overriding default configuration
devDisabledInStaging: true,
entryFile: "index.js"
]
project.ext.envConfigFiles = [
debug: ".env.development",
staging: ".env.staging",
release: ".env.release"
]
project.ext.defaultEnvFile = ".env.development"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../scripts/dotenv.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.apply"
minSdkVersion 16
targetSdkVersion 22
versionCode 53
versionName "1.3.3"
ndk {
abiFilters "armeabi-v7a", "x86"
}
resValue "string", "build_config_package", "com.apply"
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
multiDexEnabled true
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
signingConfigs {
release {
storeFile file(APPLY_RELEASE_STORE_FILE)
storePassword APPLY_RELEASE_STORE_PASSWORD
keyAlias APPLY_RELEASE_KEY_ALIAS
keyPassword APPLY_RELEASE_KEY_PASSWORD
}
}
lintOptions {
abortOnError false
disable "ResourceType"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
debug {
resValue "string", "app_name", "Discloz dev"
applicationIdSuffix '.debug'
}
staging {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
resValue "string", "app_name", "Discloz test"
applicationIdSuffix '.staging'
zipAlignEnabled true
}
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
resValue "string", "app_name", "Discloz"
zipAlignEnabled true
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-share-extension')
compile project(':react-native-sensitive-info')
compile(project(':react-native-firebase')) {
exclude group: 'com.google.firebase'
exclude group: 'com.google.android'
exclude group: 'com.facebook.react'
}
compile "com.google.firebase:firebase-core:11.0.4"
compile "com.google.firebase:firebase-auth:11.0.4"
compile "com.google.firebase:firebase-database:11.0.4"
compile "com.google.firebase:firebase-messaging:11.0.4"
compile "com.google.firebase:firebase-storage:11.0.4"
compile "com.google.firebase:firebase-analytics:11.0.4"
compile "com.google.android.gms:play-services-base:11.0.4"
compile "com.android.support:multidex:1.0.3"
compile project(':react-native-device-info')
compile project(':react-native-code-push')
compile project(':bugsnag-react-native')
compile project(':react-native-branch')
compile project(':react-native-fetch-blob')
compile project(':react-native-vector-icons')
compile project(':react-native-contacts')
compile project(':react-native-video')
compile project(':react-native-hockeyapp')
compile project(':react-native-config')
compile project(':react-native-camera')
compile project(':react-native-video-editor')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:support-v4:23.0.1"
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'net.hockeyapp.android:HockeySDK:4.1.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 {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
}
}
subprojects {
ext {
compileSdk = 23
buildTools = "23.0.3"
minSdk = 16
targetSdk = 22
}
afterEvaluate { project ->
if (!project.name.equalsIgnoreCase("app")
&& project.hasProperty("android")) {
android {
compileSdkVersion compileSdk
buildToolsVersion buildTools
defaultConfig {
minSdkVersion minSdk
targetSdkVersion targetSdk
}
lintOptions {
abortOnError false
}
}
}
}
}
我尝试了很多事情:清洁,重建,...库的版本似乎在任何需要的地方都是一样的,multidex似乎是正确设置的。
你能帮帮我吗?
谢谢!
buildscript {
repositories {
jcenter()
google()
//or
// maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'net.hockeyapp.android:HockeySDK:4.1.0'
classpath 'com.google.gms:google-services:3.1.1' //use latest plugin version
}
}
然后清理和重建项目。
添加最新的firebase依赖项版本
compile "com.google.firebase:firebase-auth:16.0.1"
compile "com.google.firebase:firebase-database:16.0.1"
compile "com.google.firebase:firebase-messaging:16.0.1"
compile "com.google.firebase:firebase-storage:16.0.1"
compile "com.google.firebase:firebase-analytics:16.0.1"
compile "com.google.android.gms:play-services-base:15.0.1"
请按此链接查看最新版本的firebase,而google play服务请按以下链接查看
e/androidruntime:致命异常:main process:com.eldercare.fajri.eldercare,pid:30948 java.lang.noClassDefFounderror:解析失败:lcom/google/android/gms/common/internal/zzbp;在com.google.firebase.firestore.firebase.fire
gradle.app 请告诉我这里做错了什么!
问题内容: 我正在按照教程(链接)将图像上传到Firebase数据库,但遇到以下错误。我重新检查了gradle依赖项并启用了multidex支持,但仍然存在错误 Gradle.app 请在这里告诉我我做错了! 问题答案: 现在这是问题所在,您在gradle的依赖项中使用了不同的版本,请更改此 对此 还有一件事是现在不建议使用,因此您需要替换为 ,这是该https://firebase.google
AndroidManifest.xml: 我知道NoClassDefFoundError是做什么的,但我没有发现问题。询问你是否需要更多的解决问题的文件。
自从我更新到Android Studio3.1后,我的项目就不再运行了。我在互联网上到处寻找解决办法,但没有任何积极的结果。下面是我在logcat中得到的错误: 这是我的build.gradle(module:app)文件: 下面是我的build.gradle(项目:appname): 编辑:它不再成功构建了,它在构建消息控制台中抛出了一个非常奇怪的错误: .
错误:将字节码转换为dex时出错:原因:com.android.dex。DexException:多个dex文件定义Lcom/google/android/gms/internal/zzbqy; 这个错误出现在我的android聊天应用程序中,我在这里找到了几个答案,但它无法解决我的问题。我正在为我的项目使用Firebase,我已经成功地对我的用户进行了身份验证,并想在实时数据库中应用他们的照片和