У меня был существующий проект andengine в eclipse, который я перенес в Android Studio. Градул не показывает ошибок, и я могу успешно построить apk. Но всякий раз, когда я открываю/запускаю apk на моем телефоне, он падает с самого начала с указанной ошибкой. Я пробовал много случайных вещей, читая здесь и там, но не смог понять проблему.FATAL EXCEPTION: main java.lang.NoClassDefFoundError: org.andengine.engine.options.SoundOptions
Ниже представлена подробная ошибка, которую я получаю от логарифма. Есть строка, которую я могу заметить, это FATAL EXCEPTION: main java.lang.NoClassDefFoundError: org.andengine.engine.options.SoundOptions
Так что как-то и не нахожу SoundOptions и некоторые другие классы во время выполнения.
Это мой код onCreateEngineOptions, где он показывает сбой. Дайте мне знать, если вам нужно что-нибудь еще с моей стороны.
@Override
public EngineOptions onCreateEngineOptions() {
abc();
prefs = this.getSharedPreferences(
"MY_PACKAGE", Context.MODE_PRIVATE);
camera = new FollowCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOption = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new FillResolutionPolicy(), camera);
engineOption.getAudioOptions().setNeedsMusic(true);
engineOption.getAudioOptions().setNeedsSound(true);
engineOption.getRenderOptions().getConfigChooserOptions().setRequestedMultiSampling(true);
engineOption.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
engineOption.getTouchOptions().setNeedsMultiTouch(true);
return engineOption;
}
Вот мой build.gradle (модуль: приложение)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "MY_PACKAGE"
minSdkVersion 9
targetSdkVersion 22
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
productFlavors {
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile project(':BaseGameUtils')
compile project(':facebook')
compile project(':AndEngine')
compile project(':andEnginePhysicsBox2D')
}
Журналы:
06-18 16:22:03.761 14042-14042/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid parameter app
06-18 16:22:03.771 14042-14042/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
06-18 16:22:05.453 4974-4974/? E/dalvikvm﹕ Could not find class 'android.app.Notification$Action$Builder', referenced from method b.a
06-18 16:22:05.623 4974-4974/? E/dalvikvm﹕ Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method b.a
06-18 16:22:06.033 4974-4974/? E/dalvikvm﹕ Could not find class 'android.app.Notification$Action$Builder', referenced from method b.a
06-18 16:22:06.133 4974-4974/? E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method b.a
06-18 16:22:06.133 4974-4974/? E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method b.a
06-18 16:22:06.143 4974-4974/? E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method b.a
06-18 16:22:06.334 4974-4974/? E/dalvikvm﹕ Could not find class 'android.app.RemoteInput[]', referenced from method b.a
06-18 16:22:06.394 4974-4974/? E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method b.b
06-18 16:22:14.932 5041-5148/MY_PACKAGE E/dalvikvm﹕ Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
06-18 16:22:14.962 5041-5148/MY_PACKAGE E/GooglePlayServicesUtil﹕ The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-18 16:22:15.022 5041-5148/MY_PACKAGE E/dalvikvm﹕ Could not find class 'com.google.android.gms.ads.identifier.AdvertisingIdClient$zza', referenced from method com.google.android.gms.ads.identifier.AdvertisingIdClient.zzaJ
06-18 16:22:15.052 5041-5148/MY_PACKAGE E/GooglePlayServicesUtil﹕ The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-18 16:22:15.282 5041-5041/MY_PACKAGE E/dalvikvm﹕ Could not find class 'org.andengine.engine.handler.UpdateHandlerList', referenced from method org.andengine.engine.camera.Camera.allocateUpdateHandlers
06-18 16:22:15.613 5041-5041/MY_PACKAGE E/dalvikvm﹕ Could not find class 'org.andengine.engine.options.SoundOptions', referenced from method org.andengine.engine.options.AudioOptions.<init>
06-18 16:22:15.793 5041-5041/MY_PACKAGE E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: org.andengine.engine.options.SoundOptions
at org.andengine.engine.options.AudioOptions.<init>(AudioOptions.java:18)
at org.andengine.engine.options.EngineOptions.<init>(EngineOptions.java:32)
at MY_PACKAGE.GameActivity.onCreateEngineOptions(GameActivity.java:209)
at org.andengine.ui.activity.BaseGameActivity.onCreate(BaseGameActivity.java:82)
at MY_PACKAGE.GameActivity.onCreate(GameActivity.java:289)
at android.app.Activity.performCreate(Activity.java:4538)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2240)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
06-18 16:22:15.843 1601-5647/? E/EmbeddedLogger﹕ App crashed! Process: MY_PACKAGE
06-18 16:22:15.843 1601-5647/? E/EmbeddedLogger﹕ App crashed! Package: MY_PACKAGE v1 (1.0)
06-18 16:22:15.843 1601-5647/? E/EmbeddedLogger﹕ Application Label: MY_APP_LABEL
Пожалуйста, покажите ваш build.gradle (модуль: приложение) ... – AndroidLad
@ohm Обновлено с build.gradle –