Android Java应用程序只能在一个版本上运行,而不能在下一个版本上运行

Android Java应用程序只能在一个版本上运行,而不能在下一个版本上运行,第1张

概述我对android很陌生,实际上是昨天才开始的.我设法获得带有标签的应用程序设置.它在2.2虚拟avd上运行良好(我认为这被称为).但是我的HTC版本是2.0.1我在下面发布代码片段以及调试信息.Logcat显示以下错误08-02 09:56:05.946: WARN/dalvikvm(414): threadid=3: thread exiting wit

我对android很陌生,实际上是昨天才开始的.我设法获得带有标签的应用程序设置.它在2.2虚拟avd上运行良好(我认为这被称为).但是我的HTC版本是2.0.1
我在下面发布代码片段以及调试信息.

Logcat显示以下错误

08-02 09:56:05.946: WARN/dalvikvm(414): threadID=3: thread exiting with uncaught exception (group=0x4001b188)08-02 09:56:05.956: ERROR/AndroIDRuntime(414): Uncaught handler: thread main exiting due to uncaught exception08-02 09:56:06.196: ERROR/AndroIDRuntime(414): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.hyperActiveSolutions/org.hyperActiveSolutions.Organizer}: java.lang.NullPointerException08-02 09:56:06.196: ERROR/AndroIDRuntime(414):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2481)08-02 09:56:06.196: ERROR/AndroIDRuntime(414):     at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2497)

还有更多,但我认为这是相关的,其余只是长堆栈跟踪.

我的androID清单文件看起来像这样

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"      package="org.hyperActiveSolutions"      androID:versionCode="1"      androID:versionname="1.0">    <application androID:icon="@drawable/icon" androID:label="@string/app_name">        <activity androID:label="@string/app_name"                  androID:theme="@androID:style/theme.NoTitlebar" androID:name="Organizer">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>    <activity androID:name="Home" ></activity><activity androID:name="Account"></activity><activity androID:name="Agenda" ></activity><activity androID:name="Lists" ></activity></application><uses-sdk androID:minSdkVersion="6" androID:targetSdkVersion="6"></uses-sdk></manifest> 

如您所见,最低sdk和目标已设置为我手机的版本.这是我入门课程的开始.在此代码段结束的下方,以与“主页”完全相同的方式添加了其他3个选项卡.

public class Organizer extends tabactivity {    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);             this.setContentVIEw(R.layout.main);        final TabHost tabHost = getTabHost();  // The activity TabHost   // Create an Intent to launch an Activity for the tab (to be reused)   // Initialize a TabSpec for each tab and add it to the TabHost   tabHost.addTab(tabHost.newTabSpec("home").setIndicator("Home",getResources().getDrawable(R.drawable.home)).setContent(new Intent().setClass(this,Home.class)));

我所有的资源都存在,包括每个选项卡实例化的类.
我唯一想到的可能与之相关的是布局的main.xml.
在教程之一中,它是从androID dev网站复制的.

<?xml version="1.0" enCoding="utf-8"?><TabHost xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@androID:ID/tabhost"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent">    <linearLayout        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent">        <TabWidget            androID:ID="@androID:ID/tabs"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content" />        <FrameLayout            androID:ID="@androID:ID/tabcontent"            androID:layout_wIDth="fill_parent"            androID:layout_height="fill_parent" />    </linearLayout></TabHost>

正如我所说的,它在2.2版上可以正常运行,但在2.0.1版上死了,并且屏幕上显示的消息只是“ Organizer意外终止”.

因此,任何人都可以发现我拥有的所有内容,使其与2.0.1 SDK不兼容.

提前致谢

全栈跟踪

08-02 11:47:54.006: WARN/dalvikvm(2588): threadID=3: thread exiting with uncaught exception (group=0x4001b188)08-02 11:47:54.016: ERROR/AndroIDRuntime(2588): Uncaught handler: thread main exiting due to uncaught exception08-02 11:47:54.256: ERROR/AndroIDRuntime(2588): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.organizer/com.organizer.Organizer}: java.lang.NullPointerException08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2481)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2497)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread.access00(ActivityThread.java:119)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.os.Handler.dispatchMessage(Handler.java:99)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.os.Looper.loop(Looper.java:123)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread.main(ActivityThread.java:4338)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at java.lang.reflect.Method.invokeNative(Native Method)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at java.lang.reflect.Method.invoke(Method.java:521)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:618)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at dalvik.system.NativeStart.main(Native Method)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588): Caused by: java.lang.NullPointerException08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.Widget.TabWidget.onFocusChange(TabWidget.java:351)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEw.onFocusChanged(VIEw.java:2622)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEw.handleFocusGainInternal(VIEw.java:2445)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.handleFocusGainInternal(VIEwGroup.java:403)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEw.requestFocus(VIEw.java:3562)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:975)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:1020)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:976)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:1020)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:979)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:1020)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:976)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:1020)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:979)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEw.requestFocus(VIEw.java:3513)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.vIEw.VIEw.requestFocus(VIEw.java:3491)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.Widget.TabHost.setCurrentTab(TabHost.java:334)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.Widget.TabHost.addTab(TabHost.java:213)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at com.organizer.Organizer.onCreate(Organizer.java:25)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2444)08-02 11:47:54.256: ERROR/AndroIDRuntime(2588):     ... 11 more08-02 11:47:54.476: INFO/Process(62): Sending signal. PID: 2588 SIG: 308-02 11:47:54.476: INFO/dalvikvm(2588): threadID=7: reacting to signal 308-02 11:47:54.476: ERROR/dalvikvm(2588): Unable to open stack trace file '/data/anr/traces.txt': Permission denIEd08-02 11:48:01.446: INFO/dalvikvm(2588): DeBUGger has detached; object registry had 306 entrIEs08-02 11:48:02.466: DEBUG/ddm-heap(2588): Got feature List request
最佳答案您正在使用哪个SDK版本来构建项目?如果它高于6,则必须确保您没有使用版本6之后添加的sdk部分.我要问的是,因为它暗示着您已将目标版本从8(2.2)降低了

如果这样做没有帮助,也许您可​​以发布完整的堆栈跟踪信息,这可能会提供其他线索.

总结

以上是内存溢出为你收集整理的Android Java应用程序只能在一个版本上运行,而不能在下一个版本上运行 全部内容,希望文章能够帮你解决Android Java应用程序只能在一个版本上运行,而不能在下一个版本上运行 所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1145374.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存