我正在尝试通过这样的意图将活动更改为打开嵌入式Google地图的片段活动:
Intent driver = new Intent(getApplicationContext(), DriverActivity.class);
startActivity(driver);
但应用程序崩溃了,我最近从Windows上的Eclipse迁移到了Ubuntu上的Eclipse。我不明白为什么应用程序不会改变活动。调试器打开layoutInflater.class,窗口内的消息是:找不到源
出了什么问题,我该如何解决?
07-04 19:47:09.828: E/AndroidRuntime(30884): FATAL EXCEPTION: main
07-04 19:47:09.828: E/AndroidRuntime(30884): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.Activity.setContentView(Activity.java:1867)
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.codele.blackcab.DriverActivity.onCreate(DriverActivity.java:51)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.Activity.performCreate(Activity.java:5008)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.ActivityThread.access$600(ActivityThread.java:138)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.os.Handler.dispatchMessage(Handler.java:99)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.os.Looper.loop(Looper.java:213)
07-04 19:47:09.828: E/AndroidRuntime(30884): at android.app.ActivityThread.main(ActivityThread.java:4787)
07-04 19:47:09.828: E/AndroidRuntime(30884): at java.lang.reflect.Method.invokeNative(Native Method)
07-04 19:47:09.828: E/AndroidRuntime(30884): at java.lang.reflect.Method.invoke(Method.java:511)
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
07-04 19:47:09.828: E/AndroidRuntime(30884): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
07-04 19:47:09.828: E/AndroidRuntime(30884): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
使用此:
Intent driver = new Intent(this, DriverActivity.class);
startActivity(driver);