gpt4 book ai didi

java - com.github.bumptech.glide :glide making app crash

转载 作者:行者123 更新时间:2023-12-01 16:56:19 32 4
gpt4 key购买 nike

我正在尝试使用 firebase 在 android studio 中开发一个消息应用程序。根本没有语法错误。但是当我使用实现 'com.github.bumptech.glide:glide:4.8.0' 依赖项时我已经尝试更改依赖项版本,但它不起作用。无论我是否使用了glide in,应用程序都会崩溃。有人可以告诉我出了什么问题以及如何解决它。提前致谢。

.class文件

package kanti.kushal.team;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;


import com.bumptech.glide.Glide;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import de.hdodenhof.circleimageview.CircleImageView;
import kanti.kushal.team.Model.User;

public class MainActivity extends AppCompatActivity {

CircleImageView profile_image;
TextView username;

FirebaseUser firebaseUser;
DatabaseReference reference;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");

profile_image =findViewById(R.id.profile_image);
username =findViewById(R.id.username);

firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
reference = FirebaseDatabase.getInstance().getReference("Users").child(firebaseUser.getUid());

reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
User user =dataSnapshot.getValue(User.class);
username.setText(user.getUsername());
if(user.getImageURL().equals("default")){
profile_image.setImageResource(R.mipmap.ic_launcher);
}
else{
Glide.with(MainActivity.this).load(user.getImageURL()).into(profile_image);
}

}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {


}
});

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu,menu);
return true;
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.logout:
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(MainActivity.this,StartActivity.class));
finish();
return true;
}
return false;
}
}

日志猫

2020-05-04 07:27:17.148 13377-13377/? I/nti.kushal.tea: Late-enabling -Xcheck:jni
2020-05-04 07:27:17.170 13377-13377/? E/nti.kushal.tea: Unknown bits set in runtime_flags: 0x28000
2020-05-04 07:27:17.375 13377-13377/kanti.kushal.team W/nti.kushal.tea: Bad encoded_array value: Failure to verify dex file '/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk': Bad encoded_value method type size 7
2020-05-04 07:27:17.380 13377-13377/kanti.kushal.team E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[zip file "/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk"],nativeLibraryDirectories=[/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:272)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:881)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:976)
at android.app.LoadedApk.getResources(LoadedApk.java:1227)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2562)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2554)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6682)
at android.app.ActivityThread.access$1700(ActivityThread.java:240)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2061)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:228)
at android.app.ActivityThread.main(ActivityThread.java:7782)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk': Bad encoded_value method type size 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:365)
at dalvik.system.DexFile.<init>(DexFile.java:107)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:877)
... 13 more
2020-05-04 07:27:17.386 13377-13377/kanti.kushal.team I/Perf: Connecting to perf service.
2020-05-04 07:27:17.394 13377-13377/kanti.kushal.team D/AndroidRuntime: Shutting down VM
2020-05-04 07:27:17.396 13377-13377/kanti.kushal.team E/AndroidRuntime: FATAL EXCEPTION: main
Process: kanti.kushal.team, PID: 13377
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk"],nativeLibraryDirectories=[/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/lib/arm64, /system/lib64, /system/product/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:7397)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6898)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6793)
at android.app.ActivityThread.access$1700(ActivityThread.java:240)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2061)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:228)
at android.app.ActivityThread.main(ActivityThread.java:7782)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk"],nativeLibraryDirectories=[/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
at android.app.ActivityThread.installProvider(ActivityThread.java:7381)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6898) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6793) 
at android.app.ActivityThread.access$1700(ActivityThread.java:240) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2061) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:228) 
at android.app.ActivityThread.main(ActivityThread.java:7782) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981) 
Suppressed: java.io.IOException: Failed to open dex files from /data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/kanti.kushal.team-OTM4Wfvta-iKPUM0Clt1FA==/base.apk': Bad encoded_value method type size 7
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:365)
at dalvik.system.DexFile.<init>(DexFile.java:107)
at dalvik.system.DexFile.<init>(DexFile.java:80)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:877)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:976)
at android.app.LoadedApk.getResources(LoadedApk.java:1227)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2562)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2554)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6682)
... 8 more
2020-05-04 07:27:17.413 13377-13377/? I/Process: Sending signal. PID: 13377 SIG: 9

最佳答案

修改您的build.gradle

  android {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
}

关于java - com.github.bumptech.glide :glide making app crash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61584116/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com