gpt4 book ai didi

Android 错误膨胀类 pl.droidsonroids.gif.GifImageView

转载 作者:太空狗 更新时间:2023-10-29 14:46:45 25 4
gpt4 key购买 nike

我正在使用 android studio 运行我的项目,它在 android 版本 5.1 的设备中正常运行,但它在 android 版本 4.4.4 的设备中崩溃,我搜索了很多但我没有找到任何解决我的问题的方法。请提供任何帮助。

堆栈跟踪:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mmido.asfarandroid/com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class pl.droidsonroids.gif.GifImageView 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2385)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436)
at android.app.ActivityThread.access$800(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5398)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class pl.droidsonroids.gif.GifImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity.onCreate(MainActivity.java:52)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2349)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436) 
at android.app.ActivityThread.access$800(ActivityThread.java:157) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:5398) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "pl.droidsonroids.gif.GifImageView" on path: DexPathList[[zip file "/data/app/com.example.mmido.asfarandroid-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.mmido.asfarandroid-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity.onCreate(MainActivity.java:52) 
at android.app.Activity.performCreate(Activity.java:5264) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2349) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2436) 
at android.app.ActivityThread.access$800(ActivityThread.java:157) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:193) 
t android.app.ActivityThread.main(ActivityThread.java:5398) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
at dalvik.system.NativeStart.main(Native Method) 

这是我的 Java 代码

public class MainActivity extends AppCompatActivity {
GifImageView gifImageView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gifImageView = (GifImageView) findViewById(R.id.gifview);
try {
GifDrawable gifDrawable = new GifDrawable(getResources(), R.drawable.comp_1);
gifImageView.setImageDrawable(gifDrawable);
} catch (Resources.NotFoundException e) {

e.printStackTrace();
} catch (IOException e) {

e.printStackTrace();
}


}
}

Gradle :

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example.mmido.asfarandroid"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:multidex:1.0.0'
compile 'cz.msebera.android:httpclient:4.4.1.1'
compile 'cz.msebera.android:httpclient:4.4.1.1'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.2.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.16'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'



testCompile 'junit:junit:4.12'
compile project(':FORTSDKv1.2')
compile ('com.android.support:appcompat-v7:+'){
transitive = true;
}
compile 'com.victor:lib:1.0.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.shamanland:fonticon:0.1.9'
compile 'com.android.support:design:23.3.0'
compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.google.guava:guava:19.0'
compile 'org.bouncycastle:bcprov-jdk16:1.46'
compile 'commons-codec:commons-codec:1.10'


}

XML 文件:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.mmido.trivelgob2b.TrivelgoB2B.MainActivity"
android:background="@drawable/new_splash">

<pl.droidsonroids.gif.GifImageView
android:layout_width="120dp"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginBottom="20dp"
android:id="@+id/gifview"
/>

</FrameLayout>

最佳答案

最近遇到这种情况,通过升级Gradle版本3.5.13.5.3解决了这个问题>。

Note: This issue occurs with the Gradle version So you need to downgrade or upgrade the version number

关于Android 错误膨胀类 pl.droidsonroids.gif.GifImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39348062/

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