My android app keeps crashing when I launch it - android

I recently got some app source code. So I imported to Eclipse and renamed application package. It all went well until I tried launch the app. When I do it instantly crashes. I was wondering why. This is the log:
E/ActivityManager( 215): heap conf. property name string trimmed: hs.com.shadycorp.MoonStoneMarbl
E/AndroidRuntime( 5644): FATAL EXCEPTION: main
E/AndroidRuntime( 5644): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.shadycorp.MoonStoneMarble/theHardestGame.pac.GameLogicController}: java.lang.ClassNotFoundException: theHardestGame.pac.GameLogicController in loader dalvik.system.PathClassLoader[/data/app/com.shadycorp.MoonStoneMarble-1.apk]
E/AndroidRuntime( 5644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1580)
E/AndroidRuntime( 5644): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1674)
E/AndroidRuntime( 5644): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 5644): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:942)
E/AndroidRuntime( 5644): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5644): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 5644): at android.app.ActivityThread.main(ActivityThread.java:3735)
E/AndroidRuntime( 5644): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5644): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 5644): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime( 5644): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:662)
E/AndroidRuntime( 5644): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5644): Caused by: java.lang.ClassNotFoundException: theHardestGame.pac.GameLogicController in loader dalvik.system.PathClassLoader[/data/app/com.shadycorp.MoonStoneMarble-1.apk]
E/AndroidRuntime( 5644): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E/AndroidRuntime( 5644): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
E/AndroidRuntime( 5644): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 5644): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 5644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1572)
E/AndroidRuntime( 5644): ... 11 more
E/AndroidRuntime( 5644): [Blue Error Handler] Make Debugging Report file for main
E/AndroidRuntime( 5644): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.shadycorp.MoonStoneMarble/theHardestGame.pac.GameLogicController}: java.lang.ClassNotFoundException: theHardestGame.pac.GameLogicController in loader dalvik.system.PathClassLoader[/data/app/com.shadycorp.MoonStoneMarble-1.apk]
E/AndroidRuntime( 5644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1580)
E/AndroidRuntime( 5644): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1674)
E/AndroidRuntime( 5644): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 5644): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:942)
E/AndroidRuntime( 5644): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5644): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 5644): at android.app.ActivityThread.main(ActivityThread.java:3735)
E/AndroidRuntime( 5644): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5644): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 5644): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime( 5644): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:662)
E/AndroidRuntime( 5644): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5644): Caused by: java.lang.ClassNotFoundException: theHardestGame.pac.GameLogicController in loader dalvik.system.PathClassLoader[/data/app/com.shadycorp.MoonStoneMarble-1.apk]
E/AndroidRuntime( 5644): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
E/AndroidRuntime( 5644): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
E/AndroidRuntime( 5644): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 5644): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 5644): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1572)
this is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="theHardestGame.pac"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".GameLogicController"
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>

Check the default action in AndroidManifest.xml. It's probably set to theHardestGame.pac.GameLogicController and should be something else.

Looks like you've not updated the package consistently. In your manifest it's "theHardestGame.pac", while the application package seems to be "com.shadycorp.MoonStoneMarble". I suggest you search for those strings and make sure you've updated everything. Also make sure you're doing a clean build.

Related

Google play services 6.1.11 (....-012) are crashing when trying to open leaderboard on android 2.3.5 and 2.3.6

While testing my latest android game on 2.3.5 the leader boards (using Google play services) kept crashing although I used previously tested code in other games. So I tried out apps from the play store, and noticed that all apps are crashing when opening the leader boards on android devices with 2.3
Is this a bug in google play services? (I am using the API9+ version of PLay services)
Test devices:
HTC ChaCha 2.3.5
Samsung Galaxy GIO 2.3.6
Anyone has an idea? Do have have an android 2.3 device that currently has a game with play services leaderboards successfully opening?
Thank you
EDIT3:
I opened a defect for the issue since the new versions of play services did not fix it:
https://code.google.com/p/play-games-platform/issues/detail?id=194
feel free to star the issue
PS: you might not get crash reports in your developer console because the game continues to run it is the services/leaderboards activity that crashes
EDIT2:
Issue still present on 6.1.83 !
EDIT1:
Adding the stack below, it seems that there is a resource missing which is in the GUI of the leaderboard, and as far as I know, the developer cannot fix it in his app because the play services project will be used is the one fetched from the play services version running on the user's device right?
Stack
E/AndroidRuntime( 1928): android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.Ch
eckBox
E/AndroidRuntime( 1928): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
E/AndroidRuntime( 1928): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater
.java:56)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:707)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime( 1928): at com.google.android.gms.games.ui.common.leaderboards.o.a(SourceFile:113)
E/AndroidRuntime( 1928): at com.google.android.gms.games.ui.cg.a(SourceFile:14)
E/AndroidRuntime( 1928): at com.google.android.gms.games.ui.bo.a(SourceFile:18)
E/AndroidRuntime( 1928): at android.support.v7.widget.cf.b(SourceFile:3204)
E/AndroidRuntime( 1928): at android.support.v7.widget.au.a(SourceFile:1789)
E/AndroidRuntime( 1928): at android.support.v7.widget.am.a(SourceFile:268)
E/AndroidRuntime( 1928): at android.support.v7.widget.LinearLayoutManager.a(SourceFile:1251)
E/AndroidRuntime( 1928): at android.support.v7.widget.LinearLayoutManager.a(SourceFile:508)
E/AndroidRuntime( 1928): at android.support.v7.widget.am.a(SourceFile:82)
E/AndroidRuntime( 1928): at android.support.v7.widget.RecyclerView.e(SourceFile:1869)
E/AndroidRuntime( 1928): at android.support.v7.widget.RecyclerView.onLayout(SourceFile:2106)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.support.v4.widget.SwipeRefreshLayout.onLayout(SourceFile:536)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at com.google.android.play.headerlist.PlayHeaderListLayout.onLayout(SourceFile:798)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
E/AndroidRuntime( 1928): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
E/AndroidRuntime( 1928): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.support.v7.internal.widget.ActionBarOverlayLayout.onLayout(SourceFile:503)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 1928): at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 1928): at android.view.ViewRoot.performTraversals(ViewRoot.java:1146)
E/AndroidRuntime( 1928): at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
E/AndroidRuntime( 1928): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1928): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1928): at android.app.ActivityThread.main(ActivityThread.java:3687)
E/AndroidRuntime( 1928): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1928): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1928): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/AndroidRuntime( 1928): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/AndroidRuntime( 1928): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1928): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 1928): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 1928): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
E/AndroidRuntime( 1928): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
E/AndroidRuntime( 1928): ... 54 more
E/AndroidRuntime( 1928): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/games_white_check
box.xml from drawable resource ID #0x7f020165
E/AndroidRuntime( 1928): at android.content.res.Resources.loadDrawable(Resources.java:1697)
E/AndroidRuntime( 1928): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
E/AndroidRuntime( 1928): at android.widget.CompoundButton.<init>(Compo
I have the same thing started recently (Android 2.3.6).
I think there is only Google can fix (

How to override or.apache.http in Android platform

I have wrote an Android application that uses HttpComponents from Apache to make a connection to server.
The version I used is 4.3 (newest), everything is ok, except when running.
I got exception
E/AndroidRuntime( 1699): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<in
it>(PoolingHttpClientConnectionManager.java:487)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:147)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:136)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConne
ctionManager.java:112)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.util.ApacheHTTP.<init>(ApacheHTTP.java:97)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity$3.<init>(WeatherLifeActivity.java:105)
E/AndroidRuntime( 1699): at net.xnano.weatherlife.view.WeatherLifeActivity.onOptionsItemSelected(WeatherLifeActivity.j
ava:105)
E/AndroidRuntime( 1699): at android.app.Activity.onMenuItemSelected(Activity.java:2548)
E/AndroidRuntime( 1699): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:980)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:547)
E/AndroidRuntime( 1699): at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:115)
E/AndroidRuntime( 1699): at android.view.View.performClick(View.java:4204)
E/AndroidRuntime( 1699): at android.view.View$PerformClick.run(View.java:17355)
E/AndroidRuntime( 1699): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime( 1699): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1699): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1699): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1699): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1699): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1699): Caused by: java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:72)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConne
ctionFactory.java:84)
E/AndroidRuntime( 1699): at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientCon
nectionFactory.java:59)
E/AndroidRuntime( 1699): ... 25 more
E/AndroidRuntime( 1699): Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:52)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFac
tory.java:56)
E/AndroidRuntime( 1699): at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterF
actory.java:46)
E/AndroidRuntime( 1699): ... 28 more
The library (in jar archive) which I added to libs folder has been exported, it seems the application uses internal org.apache.http package instead of my own library.
The IDE is Intellij Idea.
Did anyone solve this issue before please help me?
This issue is presented a few times in SO. The solution I took was to use a repackaged version of the library called httpclientandroidlib. This was presented as a solution in a newer version of this question at How to Override Android Api Class with a class available in added jar?
You can use your own library in next way
com.yourlibrary.MyClass myClass= new com.yourlibrary.MyClass();

App crashed when installed from Market but not if the Apk is installed manually.

My App works fine if I just install it manually by moving the apk onto the phone and installing it, however when I put it on the Market it crashes on the first Activity, this is the logcat.
E/AndroidRuntime( 999): FATAL EXCEPTION: main
E/AndroidRuntime( 999): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mbwasi.funapp/com.mbwasi.funapp.Splash}: java.lang.ClassNotFoundException: com.mbwasi.funapp.Splash in loader dalvik.system.PathClassLoader[/data/app/com.mbwasi.funapp-1.apk]
E/AndroidRuntime( 999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2721)
E/AndroidRuntime( 999): at android.app.ActivityThread.access$2300(ActivityThread.java:132)
E/AndroidRuntime( 999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
E/AndroidRuntime( 999): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 999): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 999): at android.app.ActivityThread.main(ActivityThread.java:4669)
E/AndroidRuntime( 999): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 999): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
E/AndroidRuntime( 999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
E/AndroidRuntime( 999): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 999): Caused by: java.lang.ClassNotFoundException: com.mbwasi.funapp.Splash in loader dalvik.system.PathClassLoader[/data/app/com.mbwasi.funapp-1.apk]
E/AndroidRuntime( 999): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime( 999): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 999): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 999): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2619)
E/AndroidRuntime( 999): ... 11 more
What could be happening here? I also notice in the log that the apk name has a -1 at the end too,
com.mbwasi.funapp-1.apk
where would this be coming from?
Is this on the same phone? Are you sure you are uploading the exact same APK? ClassNotFoundException could mean that some class your Splash activity is using is not found, you might be missing some library.
Well I left it overnight, refreshed the market page for my App and now it not only shows as compatible with all my devices but also works when installed. So it was a Market issue. There was a tip in the other thread to unpublish and publish and I did that, no idea if it actually did anything though.

Application fails to bind service

I am trying to bind a service which is included in a Library project with the following lines:
Intent i = new Intent();
i.setClassName("de.ring0", "de.ring0.ToolkitService");
bindService(i, this, Context.BIND_AUTO_CREATE);
The binding process fails with the debug output below. According to the Android developer documentation the options in the two manifest files should be correct.
AndroidManifest.xml Library Project
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.ring0">
<uses-sdk android:minSdkVersion="8" />
<application android:debuggable="true">
<service android:name="de.ring0.ToolkitService" android:exported="true" android:enabled="true"/>
</application>
</manifest>
AndroidManifest.xml Main Project
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.ring0.example.tactilecompass"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name" android:debuggable="true">
<activity android:name=".TactileCompassActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="de.ring0.ToolkitService" />
</application>
</manifest>
Debug Log from emulator
W/ActivityManager( 59): Permission denied: checkComponentPermission() reqUid=10036
W/ActivityManager( 59): Permission Denial: Accessing service ComponentInfo{de.ring0/de.ring0.ToolkitService} from pid=2994, uid=10037 requires null
W/dalvikvm( 2994): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 2994): FATAL EXCEPTION: main
E/AndroidRuntime( 2994): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.ring0.example.tactilecompass/de.ring0.example.tactilecompass.TactileCompassActivity}: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=de.ring0/.ToolkitService }
E/AndroidRuntime( 2994): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime( 2994): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 2994): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 2994): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 2994): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2994): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2994): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 2994): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2994): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 2994): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 2994): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 2994): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2994): Caused by: java.lang.SecurityException: Not allowed to bind to service Intent { cmp=de.ring0/.ToolkitService }
E/AndroidRuntime( 2994): at android.app.ContextImpl.bindService(ContextImpl.java:874)
E/AndroidRuntime( 2994): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
E/AndroidRuntime( 2994): at de.ring0.example.tactilecompass.TactileCompassActivity.onCreate(TactileCompassActivity.java:28)
E/AndroidRuntime( 2994): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 2994): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 2994): ... 11 more
W/ActivityManager( 59): Process de.ring0.example.tactilecompass has crashed too many times: killing!
W/ActivityManager( 59): Force finishing activity de.ring0.example.tactilecompass/.TactileCompassActivity
I/Process ( 59): Sending signal. PID: 2994 SIG: 9
Use:
new Intent(this, de.ring0.ToolkitService.class);

XML buttons that call XML drawables

I have a series of images on drawable folder that I want to reuse in a language folder (drawable-pt) so I created an xml file for each image in the language folder like this:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/habitat_over" />
then I have in a xml folder a xml file that represents button states:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="#drawable/habitat_over"/>
<item android:drawable="#drawable/habitat" />
</selector>
in the layout I have something like this:
<ImageButton android:layout_weight="1"
android:background="#null"
android:layout_width="wrap_content"
android:src="#xml/habitat_button"
android:id="#+id/habitat"
android:layout_height="wrap_content"
android:scaleType="fitCenter">
</ImageButton>
It should work but when I run the application this error shows up:
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
E/AndroidRuntime( 409): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
E/AndroidRuntime( 409): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 409): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
E/AndroidRuntime( 409): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
E/AndroidRuntime( 409): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime( 409): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime( 409): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
E/AndroidRuntime( 409): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
E/AndroidRuntime( 409): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime( 409): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 409): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
E/AndroidRuntime( 409): at android.app.Activity.setContentView(Activity.java:1657)
E/AndroidRuntime( 409): at pnm.freiramadeira.ChapterSelection.onCreate(ChapterSelection.java:90)
E/AndroidRuntime( 409): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 409): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 409): ... 11 more
E/AndroidRuntime( 409): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 409): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 409): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
E/AndroidRuntime( 409): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
E/AndroidRuntime( 409): ... 25 more
E/AndroidRuntime( 409): Caused by: android.content.res.Resources$NotFoundException: File res/xml/habitat_button.xml from drawable resource ID #0x7f050007
E/AndroidRuntime( 409): at android.content.res.Resources.loadDrawable(Resources.java:1697)
E/AndroidRuntime( 409): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
E/AndroidRuntime( 409): at android.widget.ImageView.<init>(ImageView.java:118)
E/AndroidRuntime( 409): at android.widget.ImageButton.<init>(ImageButton.java:85)
E/AndroidRuntime( 409): at android.widget.ImageButton.<init>(ImageButton.java:81)
E/AndroidRuntime( 409): ... 28 more
E/AndroidRuntime( 409): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-pt/habitat_over.xml from drawable resource ID #0x7f02002f
E/AndroidRuntime( 409): at android.content.res.Resources.loadDrawable(Resources.java:1697)
E/AndroidRuntime( 409): at android.content.res.Resources.getDrawable(Resources.java:581)
E/AndroidRuntime( 409): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:162)
E/AndroidRuntime( 409): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787)
E/AndroidRuntime( 409): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728)
E/AndroidRuntime( 409): at android.content.res.Resources.loadDrawable(Resources.java:1694)
E/AndroidRuntime( 409): ... 32 more
E/AndroidRuntime( 409): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: <bitmap> requires a valid src attribute
E/AndroidRuntime( 409): at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:375)
E/AndroidRuntime( 409): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787)
E/AndroidRuntime( 409): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728)
E/AndroidRuntime( 409): at android.content.res.Resources.loadDrawable(Resources.java:1694)
E/AndroidRuntime( 409): ... 37 more
Does anyone knows why this happens??
Thanks in advance!!
Even though it's not really documented, the android:src attribute of a <bitmap> only accepts image files (not drawables defined in XML).
Instead of having src="#drawable/habitat_over" in a bitmap and referencing that <bitmap> from your layout, remove the <bitmap> and add a direct reference to from the layout to #drawable/habitat_over.

Categories

Resources