gpt4 book ai didi

java - 如何让 Android 应用程序在 API 级别 7 和 8 上运行?

转载 作者:行者123 更新时间:2023-11-29 22:25:21 25 4
gpt4 key购买 nike

我无法让我的应用程序同时在 API 级别 7 和 8 中运行。当我在 Eclipse 中从头开始项目并针对相应的 API 级别时,代码在两个版本中都能正常工作。但是,我应该同时运行的设置在针对 7 并在启动模拟器时以 API 8 启动时会执行此操作。

[2011-05-24 11:47:02 - AndroidHTOnline] ------------------------------
[2011-05-24 11:47:02 - AndroidHTOnline] Android Launch!
[2011-05-24 11:47:02 - AndroidHTOnline] adb is running normally.
[2011-05-24 11:47:02 - AndroidHTOnline] Performing testapp.test.testapp activity launch
[2011-05-24 11:47:02 - AndroidHTOnline] Automatic Target Mode: Preferred AVD 'DROID' is not available. Launching new emulator.
[2011-05-24 11:47:02 - AndroidHTOnline] Launching a new emulator with Virtual Device 'DROID'
[2011-05-24 11:47:03 - AndroidHTOnline] New emulator found: emulator-5554
[2011-05-24 11:47:03 - AndroidHTOnline] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-24 11:47:26 - AndroidHTOnline] HOME is up on device 'emulator-5554'
[2011-05-24 11:47:26 - AndroidHTOnline] Uploading AndroidHTOnline.apk onto device 'emulator-5554'
[2011-05-24 11:47:26 - AndroidHTOnline] Installing AndroidHTOnline.apk...
[2011-05-24 11:47:50 - AndroidHTOnline] Success!
[2011-05-24 11:47:50 - AndroidHTOnline] Starting activity testapp.test.testapp on device emulator-5554
[2011-05-24 11:47:52 - AndroidHTOnline] ActivityManager: [1] Killed am start -n test...

这是我的 list 文件。切换target sdk貌似没有效果。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="testapp.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" android:maxSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false" android:enabled="true" android:allowBackup="false" android:allowClearUserData="true" android:testOnly="false">
<activity android:name=".testapp"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>

那么为什么 Activity 管理器会终止应用程序。我可以查看更详细的输出以获取更多详细信息吗?我的最小值、最大值和目标设置是否是我正在寻找的准确类型的设置?我在 Windows 上运行 Eclipse。我是 C# 程序员并且是 Android 和 Java 的新手,所以任何提示都会有所帮助。

编辑:我在这里发布了 logcat 日志文件。 http://www.strategynerd.com/log.txt我仍在浏览它以试图找到问题,如果我发现了什么,我会发回。

更新:看来错误可能发生在日志中的某处。

05-24 18:27:08.443: INFO/installd(35): move /data/dalvik-cache/data@app@testapp.test-1.apk@classes.dex -> /data/dalvik-cache/data@app@testapp.test-1.apk@classes.dex
05-24 18:27:08.554: DEBUG/PackageManager(59): New package installed in /data/app/testapp.test-1.apk
05-24 18:27:10.094: INFO/ActivityManager(59): Process com.android.settings (pid 119) has died.
05-24 18:27:12.094: INFO/ActivityManager(59): Force stopping package testapp.test uid=10036
05-24 18:27:12.834: INFO/WindowManager(59): WIN DEATH: Window{450470a0 com.android.launcher/com.android.launcher2.Launcher paused=false}

最佳答案

Is there a more detailed output I can view to get more details?

是的,答案是 Logcat。打开该透视图并发布日志。

Is my setup for min, max and target an accurate type of setup I am looking for?

您确定需要最高版本吗?一般来说,大多数在 7 中开发的东西都是向前兼容的。较新的屏幕尺寸有些人会遇到困难,但这是另一个问题。

您还可以阅读有关最小版本和目标版本 here. 之间的区别

关于java - 如何让 Android 应用程序在 API 级别 7 和 8 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6113386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com