我已经将一个项目作为一个库,同时将该库项目调用到主项目。
我制作了一个操作栏类并将其设为库,同时在主项目中调用它。
我在控制台上遇到错误,因为 Could not find *Actionbar.apk!
而logcat显示如下:
01-30 13:36:47.595: E/AndroidRuntime(404): FATAL EXCEPTION: main
01-30 13:36:47.595: E/AndroidRuntime(404): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sos.emergency/com.sos.emergency.SOSHome}: java.lang.NullPointerException
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.os.Handler.dispatchMessage(Handler.java:99)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.os.Looper.loop(Looper.java:123)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-30 13:36:47.595: E/AndroidRuntime(404): at java.lang.reflect.Method.invokeNative(Native Method)
01-30 13:36:47.595: E/AndroidRuntime(404): at java.lang.reflect.Method.invoke(Method.java:521)
01-30 13:36:47.595: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-30 13:36:47.595: E/AndroidRuntime(404): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-30 13:36:47.595: E/AndroidRuntime(404): at dalvik.system.NativeStart.main(Native Method)
01-30 13:36:47.595: E/AndroidRuntime(404): Caused by: java.lang.NullPointerException
01-30 13:36:47.595: E/AndroidRuntime(404): at com.sos.emergency.SOSHome.onCreate(SOSHome.java:35)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-30 13:36:47.595: E/AndroidRuntime(404): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-30 13:36:47.595: E/AndroidRuntime(404): ... 11 more
我正在根据给定的链接工作
http://thiranjith.wordpress.com/2011/07/15/actionbar-design-pattern-example-for-android/
连同其他引用,
http://developer.android.com/guide/developing/projects/projects-eclipse.html
和
http://developer.android.com/guide/topics/ui/actionbar.html
我已经多次清理我的项目,也尝试了网上找到的各种解决方案,但无法解决。
我的代码 fragment 出现错误,
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.home_screen);
ActionBar = (***_Actionbar) findViewById(R.id.actionBar);
ActionBar.setTitle(R.string.app_name); //getting error here
ActionBar.setHomeLogo(R.drawable.ic_title_home_default);
最佳答案
转到项目-->属性
从左侧列表中选择 Android
取消选中“是库”复选框。
关于android - 获取错误 : *****. 未找到 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9061101/