2017-12-20 3 views
0

누군가가 내 apk를 안드로이드 7에서 완벽하게 테스트했을 때 완벽한 테스트를 거쳤습니다 ...하지만 4.4.2에서 테스트했을 때 이 내 Gradle을 conf의

Drawable drawable = null; 
     Integer id_icon = 0; 
     if (materia.getIcon() != null) { 
      id_icon = getResources().getIdentifier(materia.getIcon(), "drawable", "com.package"); 
     } else { 
      Integer size = materia.getTopics().size(); 
      if (size >= 1 && size <= 9) { 
       id_icon = getResources().getIdentifier("ic_filter_" + size.toString() + "_black", "drawable", "com.package"); 
      } else { 
       if (size > 9) { 
        id_icon = getResources().getIdentifier("ic_filter_9_plus_black", "drawable", "com.package"); 
       } 
      } 
     } 
//This line is where throw the exception.... but why?? 
     if (id_icon > 0) drawable = (Drawable) getResources().getDrawable(id_icon); 
     MenuItem menuItem = sm.add(R.id.list_materiales, Menu.NONE, i, Html.fromHtml(materia.getMaterial())).setCheckable(true).setChecked(false); 
     menuItem.setIcon(drawable); 
     storageKeys.addKeyMaterial(materia.getKey()); 

입니다

: 그릴 수 ...이 내 APK 충돌이 코드 사전에

apply plugin: 'com.android.application' 
apply plugin: 'realm-android' 

android { 
    compileSdkVersion 26 
    defaultConfig { 
     applicationId "com.package" 
     minSdkVersion 19 
     targetSdkVersion 19 
     versionCode 1 
     versionName "1.0" 
     vectorDrawables.useSupportLibrary = true 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    compileOptions { 
     targetCompatibility 1.8 
     sourceCompatibility 1.8 
    } 
} 
dependencies { 
    implementation fileTree(include: ['*.jar'], dir: 'libs') 
    implementation 'com.android.support:cardview-v7:26.1.0' 
    implementation 'com.android.support:recyclerview-v7:26.1.0' 
    // 
    implementation 'com.android.support:appcompat-v7:26.1.0' 
    implementation 'com.android.support:design:26.1.0' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 'com.android.support.test.espresso:espresso-core:+' 
    implementation 'com.android.support:support-v4:26.1.0' 
    implementation 'com.android.support:support-vector-drawable:26.1.0' 
} 

감사합니다 .. 그리고 불쌍한 내 영어 죄송합니다 ...

답변

관련 문제