當我運行時Android Studio是應用程序獲得安裝工作罰款以上4.0版本...當我從apk的文件應用程序>構建>輸出> apk我想安裝我得到下面的錯誤是這樣的。 ..APK不在Kitkat中安裝?
Note:(Same apk file working 5.0 and 6.0)
我嘗試了所有的谷歌建議。
錯誤:
FATAL EXCEPTION: main Pocess: app.idea.com.ideadarpan, PID: 1032 java.lang.RuntimeException: Unable to instantiate application app.idea.com.ideadarpan.commonclass.Idea_Urban: java.lang.ClassNotFoundException: Didn't find class "app.idea.com.ideadarpan.commonclass.Idea_Urban" on path: DexPathList[[zip file "/data/app/app.idea.com.ideadarpan-1.apk"],nativeLibraryDirectories=[/data/app-lib/app.idea.com.ideadarpan-1, /vendor/lib, /system/lib, /system/lib/arm]] at android.app.LoadedApk.makeApplication(LoadedApk.java:516) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553) at android.app.ActivityThread.access$1500(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) 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:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "app.idea.com.ideadarpan.commonclass.Idea_Urban" on path: DexPathList[[zip file "/data/app/app.idea.com.ideadarpan-1.apk"],nativeLibraryDirectories=[/data/app-lib/app.idea.com.ideadarpan-1, /vendor/lib, /system/lib, /system/lib/arm]] 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.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553) at android.app.ActivityThread.access$1500(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) 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:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method)
APP:Builde.gradle:我用四個JAR文件爲PDF格式,也隱蔽JSON來擅長它在lib文件夾中,我必須使用相同的版本只要。
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "app.idea.com.ideadarpan"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
jumboMode true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dexOptions
{
javaMaxHeapSize "2048M"
preDexLibraries = false
// here heap size give 4g i got this thing from https://groups.google.com/forum/#!topic/adt-dev/P_TLBTyFWVY
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
應用類別:
public class Idea_Urban extends MultiDexApplication {
private static Idea_Urban idea_urban;
private SharedPreferences mSharedPreferences;
public static Context context;
public int recy_postion;
public static Idea_Urban getInstance() {
return idea_urban;
}
@Override
public void onCreate() {
super.onCreate();
idea_urban = this;
initSharedPreferences();
}
}
任何一個可以幫助我,請。
https://stackoverflow.com/a/33430306/3395198。你應該創建'Application'類,並且檢查第一個答案。 '即時運行' –
我已經申請類先生以及我檢查了'即時運行'..仍然同樣的問題 – Mariyappan
顯示請你的應用類 –