File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Exception while running my app. (TargetSDK 2.2 API Level 8 running on 1.5 (API Level 3) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Exception while running my app. (TargetSDK 2.2 API Level 8 running on 1.5 (API Level 3)" Watch "Exception while running my app. (TargetSDK 2.2 API Level 8 running on 1.5 (API Level 3)" New topic
Author

Exception while running my app. (TargetSDK 2.2 API Level 8 running on 1.5 (API Level 3)

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Hi,

I have developed a simple app using target sdk 8. But minSDKVersion is 3. I setup an emulator with Target SDK 1.5 (i.e. API Level 3). When my main activity starts it throws an exception while drawing view. Following is the exception.....

07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class java.lang.reflect.Constructor
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createView(LayoutInflater.java:512)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 11 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: java.lang.reflect.InvocationTargetException
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.widget.ImageView.<init>(ImageView.java:103)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at java.lang.reflect.Constructor.constructNative(Native Method)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createView(LayoutInflater.java:499)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 24 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/title_bar_shadow.9.png from drawable resource ID #0x7f020001
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.Resources.loadDrawable(Resources.java:1641)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.widget.ImageView.<init>(ImageView.java:113)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 28 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: java.io.FileNotFoundException: res/drawable/title_bar_shadow.9.png
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.AssetManager.openNonAssetNative(Native Method)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.AssetManager.openNonAsset(AssetManager.java:392)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.Resources.loadDrawable(Resources.java:1634)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 30 more
07-17 16:26:48.797: INFO/Process(568): Sending signal. PID: 790 SIG: 3
07-17 16:26:48.797: INFO/dalvikvm(790): threadid=7: reacting to signal 3
07-17 16:26:48.827: INFO/dalvikvm(790): Wrote stack trace to '/data/anr/traces.txt'


The exception boils down to filenotfound... res/drawable/title_bar_shadow.9.png. What is this file. Is this a file not present in 1.5. I am not explicity referencing this file anywhere.

Please suggest what may be the cause of the problem.

Thanks.


SCJP2, SCWCD
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 146

Can we take a look at the manifest
Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Here is my AndroidManifest.xml for your reference.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app"
android:versionCode="1"
android:versionName="1.0"
>

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8"/>

<application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/robot">
<activity android:name=".MainActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".IncomingCallReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"/>
</intent-filter>
</receiver>
<activity android:name="Prefs" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>

<activity android:name=".LookupContactsActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".ConfigureOneContactActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>

</application>
<supports-screens android:anyDensity="true" android:smallScreens="true"/>

</manifest>
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 146

A similar question with the same kind of stack trace this should answer your question.It states thats it primarily is due to the different ways SDK 1.5 & 2.2 handle drawables

-Zoheb
Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Thanks Zoheb. It helped.
 
jQuery in Action, 2nd edition
 
subject: Exception while running my app. (TargetSDK 2.2 API Level 8 running on 1.5 (API Level 3)
 
Similar Threads
android uncaught handler: thread main exiting due to uncaught exception
help with simple keyboardview test
external allocation too large for this process,Error inflating class, bitmap size exceeds VM budget
reading XML layout contains a SurfaceView
"Application has unexpectedly stopped error" when adding onClickListener