1

I am having trouble getting my app to run in both API level 7 and and 8. The code works fine in both versions when I start the project from the ground up in eclipse and I target the respective API level. However my setup that should run both does this when targeted for 7 and starting in API 8 when starting the emulator.

[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...

Here is my manifest file. Switching target sdk seemingly has no effect.

<?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>

So why is the activity manager killing the app. Is there a more detailed output I can view to get more details? Is my setup for min, max and target an accurate type of setup I am looking for? I am running Eclipse on Windows. I am C# programmer and am new to Android and Java so any tips would be helpful.

Edit: I have posted the logcat log file here. http://www.strategynerd.com/log.txt I am still looking through it to attempt to find the problem, will post back if I find something.

Update: It appears the error may be occuring somewhere here in the log.

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}
Caimen
  • 2,623
  • 2
  • 26
  • 43
  • why don't you just specify min version ? – PedroAGSantos May 24 '11 at 16:14
  • Target the newest SDK you support in your code (in this case, 8) and do not use `maxSDKversion`. All Android versions thus far have been backwards compatible so there is no reason an API level 9 or greater would not be able to run your app. – Jake Wharton May 24 '11 at 18:36
  • I have gotten rid of maxsdkversion and tested with both targets. the app still crashes the emulator. if i recreate the project starting out as api level 8 it works in the respective emulator, but then fails in the api level 7 emulator. this seems like it must be some sort of configuration problem. – Caimen May 24 '11 at 19:04

2 Answers2

2

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

Yes, the answer is Logcat. Open that perspective and post the log.

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

Are you sure you need a maximum version? Generally speaking most stuff developed in 7 is going to be forwards compatible. The newer screen sizes are where some run into difficulty, but that is a different issue.

You can also read about the difference between min and target version here.

Community
  • 1
  • 1
user432209
  • 20,007
  • 10
  • 56
  • 75
  • Thanks for getting back to me so quickly. I took out the max version, still the same problem. Finally got logcat figured out after a while. I have posted the log file here http://www.strategynerd.com/log.txt – Caimen May 24 '11 at 18:31
  • The logcat finally pointed me in the right direction, even though it wasn't immediately obvious. The emulation I had saved and been using for awhile for v2.2 had become corrupted somehow and was not acting stable. I simply created a new virtual device for 2.2 and the app finally worked. Not sure if something happened during the last update or what. Thanks for the help and an upboat for you. – Caimen May 24 '11 at 20:03
0

Android applications are generally forward-compatible with new versions of the Android platform, you don't need to specify the max version (it is explicitly recommended to not use the maxSdkVersion attribute).

Try to specify only the minSdkVersion attribute and see if it works.

Cheers

Toni Toni Chopper
  • 1,833
  • 2
  • 20
  • 29