当我在ECLIPSE中使用AlertDialog导入以下内容时
import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
我的应用程序构建但不是我想要的视图。我想用
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
但是在安装apk之后,应用程序崩溃了。我做错了什么?
崩溃日志(perdon my long crash log)
07-19 13:09:13.273: I/Process(17722): Sending signal. PID: 17722 SIG: 9
07-19 13:09:20.993: D/ResourcesManager(17894): For user 0 new
overlays fetched Null
07-19 13:09:21.023: D/JniHelper(17894): JniHelper::setJavaVM
(0xb815f940), pthread_self() = -1225135284
07-19 13:09:21.063: D/Cocos2dxActivity(17894): model=SM-J510FN
07-19 13:09:21.063: D/Cocos2dxActivity(17894): product=j5xnltexx
07-19 13:09:21.063: D/Cocos2dxActivity(17894): isEmulator=false
07-19 13:09:21.073: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 0, K2HH Acceleration , STM
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 1, CM36672P Proximity Sensor, Capella Microsystems, Inc.
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 2, SX9310 Grip Sensor, SEMTECH
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 3, Screen Orientation Sensor, Samsung Electronics
07-19 13:09:21.093: V/PTServicesBridge(17894): PTServicesBridge -- INIT
07-19 13:09:21.113: W/PopupManager(17894): You have not specified a View
to use as content view for popups. Falling back to the Activity
content view. Note that this may not work as expected in multi-
screen environments
07-19 13:09:21.123: D/AndroidRuntime(17894): Shutting down VM
07-19 13:09:21.133: E/AndroidRuntime(17894): FATAL EXCEPTION: main
07-19 13:09:21.133: E/AndroidRuntime(17894): Process: com.tembo.huerun,
PID: 17894
07-19 13:09:21.133: E/AndroidRuntime(17894): java.lang.NoClassDefFoundError:
Failed resolution of: Landroid/support/v7/appcompat/R$attr;
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog.resolveDialogTheme(AlertDialog.java:108)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog$Builder.<init>(AlertDialog.java:285)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.showRateDialog(AppRater.java:63)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.app_launched(AppRater.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.PTPlayer.onCreate(PTPlayer.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Activity.performCreate(Activity.java:6877)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.access$1100(ActivityThread.java:223)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Handler.dispatchMessage(Handler.java:102)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Looper.loop(Looper.java:158)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.main(ActivityThread.java:7231)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.reflect.Method.invoke(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1230)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v7.appcompat.R$attr" on path: DexPathList[[zip file
"/data/app/com.tembo.huerun-1/base.apk"],nativeLibraryDirectories=
[/data/app/com.tembo.huerun-1/lib/arm, /data/app/com.tembo.huerun-
1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
07-19 13:09:21.133: E/AndroidRuntime(17894): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:469)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 17 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Suppressed:
java.lang.ClassNotFoundException: android.support.v7.appcompat.R$attr
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.Class.classForName(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.findClass(ClassLoader.java:781)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:504)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 18 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.NoClassDefFoundError: Class not found using the boot class loader;
no stack trace available
07-19 13:09:22.903: I/Process(17894): Sending signal. PID: 17894 SIG: 9
答案 0 :(得分:0)
在lib文件夹中添加apcompact-v7 jar文件。