Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android错误膨胀类pl.droidsonroids.gif.GifImageView_Android_Android Studio - Fatal编程技术网

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

Android错误膨胀类pl.droidsonroids.gif.GifImageView,android,android-studio,Android,Android Studio,我正在使用android studio运行我的项目,它在android版本为5.1的设备中正常运行,但在android版本为4.4.4的设备中崩溃,我搜索了很多,但没有找到任何解决问题的方法。请提供帮助 堆栈跟踪: 这是我的Java代码 public class MainActivity extends AppCompatActivity { GifImageView gifImageView; @Override protected void onCreate(Bun

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

堆栈跟踪:

这是我的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:

XML文件:


您是否正在使用带有即时运行的Android Studio?因为这个错误在我看来很常见

尝试在不立即运行的情况下重建:

转到文件->设置->构建、执行、部署->即时运行->取消选中“启用即时运行”

还是不工作?试着把你的等级降到1.2.3,看看这是否会有不同:

    classpath 'com.android.tools.build:gradle:1.2.3'

最近,我遇到了这种情况,通过将Gradle版本
3.5.1
升级到
3.5.3
解决了这个问题

注意:Gradle版本会出现此问题,因此您需要 降级或升级版本号


将java文件放在此处,它会在
oncreate
的这一行
setContentView(R.layout.activity\u main)崩溃为什么需要所有java代码?如果没有看到您的代码,我无法帮助您,我现在就添加了它…请尝试{gifdravable gifdravable=new gifdravable(getResources(),R.dravable.comp_1);gifImageView.setimagedravable(gifdravable);}catch(Resources.NotFoundException e){e.printStackTrace();}catch(IOE异常){e.printStackTrace();}尝试删除一次并告诉我应用程序是否崩溃?如果我编辑了gradle版本,我无法同步我的项目,我会收到以下错误消息:
错误:需要gradle版本2.2。当前版本为2.10。如果使用gradle包装器,请尝试在E:\Work\Android\Apps\Trivelgob2\gradle\wrapper\gradle-wrapper.properties中编辑分发URL到gradle-2.2-all.zip。
您是否停用了instant run?
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'


}
<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>
    classpath 'com.android.tools.build:gradle:1.2.3'