迁移到Android Studio后出现奇怪的NoClassDefFoundError

时间:2015-03-16 15:02:51

标签: android android-studio migration

将应用迁移到Android Studio后,我收到此错误(我的应用正在使用包名为com.fragmentactivity的库):

java.lang.NoClassDefFoundError: com.fragmentactivity.R$array
            at com.adapter.AdapterSpinnerNavigation.<init>(AdapterSpinnerNavigation.java:21)

错误在这一行:

public class AdapterSpinnerNavigation extends BaseAdapter 
{
    private Context context;
    public String[] list;
    public AdapterSpinnerNavigation(Context context) 
    {       
        this.context = context;
       // this is error line:
       list=context.getResources().getStringArray(R.array.spinner_navigation);
    }

//主模块gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 17
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.app.main"
        minSdkVersion 17
        targetSdkVersion 17

        multiDexEnabled = true

        testApplicationId "com.app.main.test"
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':kobo2')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/commons-io-2.1.jar')
    compile files('libs/epublib-core-3.1.jar')
    compile files('libs/guice-2.0-no_aop.jar')
    compile files('libs/htmlcleaner-2.2.jar')
    compile files('libs/htmlspanner-0.5-SNAPSHOT.jar')
    compile files('libs/jsr305-1.3.9.jar')
    compile files('libs/junit-4.8.2.jar')
    compile files('libs/mockito-core-1.8.4.jar')
    compile files('libs/roboguice-2.0.jar')
    compile files('libs/roboguice-sherlock-1.5.jar')
    compile files('libs/robolectric-1.2.jar')
    compile files('libs/slf4j-android-1.6.1-RC1.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
        transitive = true;
    }
}

0 个答案:

没有答案