selectableItemBackground crashing App - android

i'm trying to make ImageButton using
android:background="?attr/selectableItemBackground" but my app crashed. I just following this answer and this question. Any idea?
Thanks for your help.
activity.xml
<ImageButton
android:id="#+id/signUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/signIn"
android:layout_alignParentBottom="true"
android:layout_marginBottom="80dp"
android:background="?attr/selectableItemBackground"
android:src="#drawable/sign_up"
android:contentDescription="#string/button_sign_up"
/>
Log Cat
05-31 18:50:24.077: W/dalvikvm(28619): threadid=1: thread exiting with uncaught exception (group=0x41d0b2a0)
05-31 18:50:24.082: E/AndroidRuntime(28619): FATAL EXCEPTION: main
05-31 18:50:24.082: E/AndroidRuntime(28619): java.lang.RuntimeException: Unable to start activity ComponentInfo{yai.properti.tujuh.tujuh.tujuh/yai.properti.tujuh.tujuh.tujuh.WelcomeActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageButton
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.access$700(ActivityThread.java:140)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.os.Looper.loop(Looper.java:137)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.main(ActivityThread.java:4921)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Method.invoke(Method.java:511)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
05-31 18:50:24.082: E/AndroidRuntime(28619): at dalvik.system.NativeStart.main(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.widget.ImageButton
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-31 18:50:24.082: E/AndroidRuntime(28619): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Activity.setContentView(Activity.java:1924)
05-31 18:50:24.082: E/AndroidRuntime(28619): at yai.properti.tujuh.tujuh.tujuh.WelcomeActivity.onCreate(WelcomeActivity.java:19)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Activity.performCreate(Activity.java:5188)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 11 more
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: java.lang.reflect.InvocationTargetException
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Constructor.constructNative(Native Method)
05-31 18:50:24.082: E/AndroidRuntime(28619): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 24 more
05-31 18:50:24.082: E/AndroidRuntime(28619): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010015 a=-1}
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.content.res.Resources.loadDrawable(Resources.java:1925)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.view.View.<init>(View.java:3449)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageView.<init>(ImageView.java:114)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageButton.<init>(ImageButton.java:87)
05-31 18:50:24.082: E/AndroidRuntime(28619): at android.widget.ImageButton.<init>(ImageButton.java:83)
05-31 18:50:24.082: E/AndroidRuntime(28619): ... 27 more

#Gopal Gopi is correct. If you have the appcompat v7 imported properly into your project, use this for android:background in your xml:
android:background="?android:attr/selectableItemBackground"
Also, make sure that whatever item you use this on has android:clickable="true"
Good luck!

To make it work you should use AppCompact base theme in your App or Activity. Like following:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>

Related

Empty map showing in my application

I'm doing an appplication that uses Google Maps, but the maps are not showing, and the only thing I see are blank squares.
Here is my Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fossa.damiano.mapsexample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".MainActivity"
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>
My activity:
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView.LayoutParams;
import com.google.android.maps.MapView;
import android.view.View;
import android.widget.LinearLayout;
public class MainActivity extends MapActivity {
MapView mapView;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
And the main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<com.google.android.maps.MapView
android:id="#+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="My Key" //I've already generated my Key
android:clickable="true" />
</RelativeLayout>
When I try to execute my application into my smartphone, the logcat shows these errors.
05-31 11:18:01.110: W/System.err(7241): IOException processing: 26
05-31 11:18:01.110: W/System.err(7241): java.io.IOException: Server returned: 3
05-31 11:18:01.115: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:18:01.115: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:18:01.120: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:18:01.120: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:18:01.120: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:18:01.125: W/System.err(7241): at java.lang.Thread.run(Thread.java:856)
05-31 11:18:16.245: W/System.err(7241): IOException processing: 26
05-31 11:18:16.245: W/System.err(7241): java.io.IOException: Server returned: 3
05-31 11:18:16.250: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:18:16.250: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:18:16.250: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:18:16.255: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:18:16.255: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:18:16.255: W/System.err(7241): at java.lang.Thread.run(Thread.java:856)
05-31 11:18:22.070: W/IInputConnectionWrapper(7241): getSelectedText on inactive InputConnection
05-31 11:18:22.070: W/IInputConnectionWrapper(7241): setComposingText on inactive InputConnection
05-31 11:18:22.070: W/IInputConnectionWrapper(7241): getExtractedText on inactive InputConnection
05-31 11:18:27.770: W/IInputConnectionWrapper(7241): showStatusIcon on inactive InputConnection
05-31 11:18:35.120: W/System.err(7241): IOException processing: 26
05-31 11:18:35.130: W/System.err(7241): java.io.IOException: Server returned: 3
05-31 11:18:35.130: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:18:35.130: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:18:35.130: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:18:35.135: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:18:35.135: W/System.err(7241): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:18:35.135: W/System.err(7241): at java.lang.Thread.run(Thread.java:856)
05-31 11:24:28.525: D/dalvikvm(8105): GC_CONCURRENT freed 169K, 14% free 9624K/11143K, paused 13ms+1ms, total 37ms
05-31 11:24:28.535: W/CursorWrapperInner(8105): Cursor finalized without prior close()
05-31 11:24:29.045: D/libEGL(8105): loaded /system/lib/egl/libEGL_mali.so
05-31 11:24:29.080: D/libEGL(8105): loaded /system/lib/egl/libGLESv1_CM_mali.so
05-31 11:24:29.085: D/libEGL(8105): loaded /system/lib/egl/libGLESv2_mali.so
05-31 11:24:29.090: D/(8105): Device driver API match
05-31 11:24:29.090: D/(8105): Device driver API version: 10
05-31 11:24:29.090: D/(8105): User space API version: 10
05-31 11:24:29.090: D/(8105): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012
05-31 11:24:29.180: D/OpenGLRenderer(8105): Enabling debug mode 0
05-31 11:24:29.185: I/MapActivity(8105): Handling network change notification:CONNECTED
05-31 11:24:29.185: E/MapActivity(8105): Couldn't get connection factory client
05-31 11:24:29.295: D/dalvikvm(8105): GC_CONCURRENT freed 116K, 14% free 9954K/11463K, paused 8ms+20ms, total 53ms
05-31 11:24:29.525: W/System.err(8105): IOException processing: 26
05-31 11:24:29.525: W/System.err(8105): java.io.IOException: Server returned: 3
05-31 11:24:29.660: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:24:29.660: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:24:29.660: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:24:29.660: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:24:29.665: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:24:29.665: W/System.err(8105): at java.lang.Thread.run(Thread.java:856)
05-31 11:24:30.075: W/System.err(8105): IOException processing: 26
05-31 11:24:30.075: W/System.err(8105): java.io.IOException: Server returned: 3
05-31 11:24:30.075: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:24:30.075: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:24:30.080: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:24:30.080: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:24:30.080: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:24:30.080: W/System.err(8105): at java.lang.Thread.run(Thread.java:856)
05-31 11:24:30.535: W/System.err(8105): IOException processing: 26
05-31 11:24:30.535: W/System.err(8105): java.io.IOException: Server returned: 3
05-31 11:24:30.540: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:24:30.540: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:24:30.540: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:24:30.540: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:24:30.540: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:24:30.540: W/System.err(8105): at java.lang.Thread.run(Thread.java:856)
05-31 11:24:30.810: W/System.err(8105): IOException processing: 26
05-31 11:24:30.815: W/System.err(8105): java.io.IOException: Server returned: 3
05-31 11:24:30.815: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:24:30.815: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:24:30.815: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:24:30.825: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:24:30.825: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:24:30.825: W/System.err(8105): at java.lang.Thread.run(Thread.java:856)
05-31 11:24:31.100: W/System.err(8105): IOException processing: 26
05-31 11:24:31.100: W/System.err(8105): java.io.IOException: Server returned: 3
05-31 11:24:31.105: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
05-31 11:24:31.105: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
05-31 11:24:31.105: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
05-31 11:24:31.105: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
05-31 11:24:31.105: W/System.err(8105): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
05-31 11:24:31.105: W/System.err(8105): at java.lang.Thread.run(Thread.java:856)
I have already enabled the internet connection, so I can't find out where the probleme is.
UPDATE
I have updated the version of the Google Maps from 1 to 2.
Here are the changes:
The manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pocket_city"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.example.pocket_city.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.pocket_city.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.pocket_city.Home"
android:configChanges="keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MonumentMapActivity"
android:label="#string/title_activity_monument_map"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxx"/>
</application>
</manifest>
The activity:
package com.example.pocket_city;
import android.app.Activity;
import android.os.Bundle;
public class MonumentMapActivity extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.monument_map);
}
}
And the xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
</RelativeLayout>
When I try execute the code it gives me these errors:
06-01 10:12:10.496: E/AndroidRuntime(28178): FATAL EXCEPTION: main
06-01 10:12:10.496: E/AndroidRuntime(28178): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pocket_city/com.example.pocket_city.MonumentMapActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread.access$700(ActivityThread.java:140)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.os.Looper.loop(Looper.java:137)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread.main(ActivityThread.java:4921)
06-01 10:12:10.496: E/AndroidRuntime(28178): at java.lang.reflect.Method.invokeNative(Native Method)
06-01 10:12:10.496: E/AndroidRuntime(28178): at java.lang.reflect.Method.invoke(Method.java:511)
06-01 10:12:10.496: E/AndroidRuntime(28178): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
06-01 10:12:10.496: E/AndroidRuntime(28178): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
06-01 10:12:10.496: E/AndroidRuntime(28178): at dalvik.system.NativeStart.main(Native Method)
06-01 10:12:10.496: E/AndroidRuntime(28178): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-01 10:12:10.496: E/AndroidRuntime(28178): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Activity.setContentView(Activity.java:1924)
06-01 10:12:10.496: E/AndroidRuntime(28178): at com.example.pocket_city.MonumentMapActivity.onCreate(MonumentMapActivity.java:11)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Activity.performCreate(Activity.java:5206)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
06-01 10:12:10.496: E/AndroidRuntime(28178): ... 11 more
06-01 10:12:10.496: E/AndroidRuntime(28178): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Fragment.instantiate(Fragment.java:584)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Fragment.instantiate(Fragment.java:552)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Activity.onCreateView(Activity.java:4849)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
06-01 10:12:10.496: E/AndroidRuntime(28178): ... 21 more
06-01 10:12:10.496: E/AndroidRuntime(28178): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment
06-01 10:12:10.496: E/AndroidRuntime(28178): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-01 10:12:10.496: E/AndroidRuntime(28178): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-01 10:12:10.496: E/AndroidRuntime(28178): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-01 10:12:10.496: E/AndroidRuntime(28178): at android.app.Fragment.instantiate(Fragment.java:574)
06-01 10:12:10.496: E/AndroidRuntime(28178): ... 24 more
UPDATE 2
I made another application that shows only the maps and it works!!
But when I tried to add that code to my application, it gives the same errors displayed above!
So, why don't the maps work on both application?
The easiest way to migrate from deprecated API v1 to API v2 is to
remove all your code related to maps
follow this link: https://developers.google.com/maps/documentation/android/start
The docs state:
https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment
about the use of MapFragment class:
Use this class only if you are targeting API 12 and above. Otherwise, use SupportMapFragment.
you min SDK is 11 therefore you should use SupportMapFragment or change you min SDK level.

Android Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer

Recently I've added ActionBarSherlock to my android project. After adding it and testing application on AVD version 4.1 everything was fine, but launching application at 2.3.3 gives the next type of errors when starting activity at setContentView:
> 04-05 18:55:03.277: E/AndroidRuntime(659): FATAL EXCEPTION: main
04-05 18:55:03.277: E/AndroidRuntime(659): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fitness.calculator/com.fitness.calculator.ProportionsActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.os.Looper.loop(Looper.java:123)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Method.invoke(Method.java:507)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-05 18:55:03.277: E/AndroidRuntime(659): at dalvik.system.NativeStart.main(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.actionbarsherlock.internal.widget.ActionBarContainer
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1045)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.fitness.calculator.MainMenuActivity.onCreate(MainMenuActivity.java:45)
04-05 18:55:03.277: E/AndroidRuntime(659): at com.fitness.calculator.ProportionsActivity.onCreate(ProportionsActivity.java:90)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 11 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.reflect.InvocationTargetException
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Constructor.constructNative(Native Method)
04-05 18:55:03.277: E/AndroidRuntime(659): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
04-05 18:55:03.277: E/AndroidRuntime(659): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 24 more
04-05 18:55:03.277: E/AndroidRuntime(659): Caused by: java.lang.NoSuchMethodError: com.actionbarsherlock.internal.widget.ActionBarContainer.setBackground
04-05 18:55:03.277: E/AndroidRuntime(659): at com.actionbarsherlock.internal.widget.ActionBarContainer.<init>(ActionBarContainer.java:58)
04-05 18:55:03.277: E/AndroidRuntime(659): ... 27 more
Does anybody have an idea what could cause that type of error? Any ideas? I can't find a solution for this problem.
I fixed this problem by re-adding clear ActionBarSherlock library. First time I have fixed all warnings in library, and that caused the problem. So don't try to fix warnings in ActionBarSherlock. Hope this will help somebody.

Android WebView OutOfMemory?

Sometimes by starting my activity which only contains a WebView I got this strange log from LogCat:
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.cb.pwapp/de.cb.pwapp.Artikel}:
android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
at android.app.Activity.setContentView(Activity.java:1924)
at de.cb.pwapp.Artikel.onCreate(Artikel.java:26)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
... 24 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
at android.content.res.Resources.loadDrawable(Resources.java:1963)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:3449)
at android.view.ViewGroup.<init>(ViewGroup.java:432)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:52)
at android.webkit.WebView.<init>(WebView.java:505)
at android.webkit.WebView.<init>(WebView.java:482)
at android.webkit.WebView.<init>(WebView.java:468)
at android.webkit.WebView.<init>(WebView.java:457)
Is it correct that my WebView runs out of memory ?
I load the WebView with a long string, representing an article, from my SQLite DB.
Any ideas how to fix this problem ?
High Res Pics as a Background was the Problem

While running COCOS2D for Android FATAL EXCEPTION: main

I am newbie in COCOS2D for Android, While trying to run the sample project(HelloWorld) provided from cocos2d I got " FATAL EXCEPTION: main" and in detail that arrived in LogCat
05-31 19:11:46.920: E/AndroidRuntime(7719): FATAL EXCEPTION: main
05-31 19:11:46.920: E/AndroidRuntime(7719): java.lang.ExceptionInInitializerError
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Class.newInstanceImpl(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Class.newInstance(Class.java:1429)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.os.Looper.loop(Looper.java:123)
05-31 19:11:46.920: E/AndroidRuntime(7719): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.reflect.Method.invoke(Method.java:521)
05-31 19:11:46.920: E/AndroidRuntime(7719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-31 19:11:46.920: E/AndroidRuntime(7719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-31 19:11:46.920: E/AndroidRuntime(7719): at dalvik.system.NativeStart.main(Native Method)
05-31 19:11:46.920: E/AndroidRuntime(7719): Caused by: java.lang.UnsatisfiedLinkError: Library helloworld not found
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.Runtime.loadLibrary(Runtime.java:461)
05-31 19:11:46.920: E/AndroidRuntime(7719): at java.lang.System.loadLibrary(System.java:557)
05-31 19:11:46.920: E/AndroidRuntime(7719): at org.cocos2dx.application.ApplicationDemo.<clinit>(ApplicationDemo.java:81)
05-31 19:11:46.920: E/AndroidRuntime(7719): ... 15 more
So can anyone please help with some idea/solution.
Again i followed reference from "http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/"
Thanks a lot.
I recomend you to change libraries to cocos2d-x, because cocos2d for android won't be updated anymore.
Cocos2d-x works in C++, and uses JNI (Java native interface) to work. Here is all the info you will need to start using it.

iSpeech SDK Android VerifyError

I used iSpeech Demo to set up a test application with iSpeech SDK but it is giving me the following exception on which I am lost...
05-31 13:41:23.218: I/dalvikvm(271): Could not find method org.ispeech.SpeechSynthesis.getInstance, referenced from method org.ispeech.sdksample.TTSActivity.prepareTTSEngine
05-31 13:41:23.218: W/dalvikvm(271): VFY: unable to resolve static method 31: Lorg/ispeech/SpeechSynthesis;.getInstance (Landroid/app/Activity;)Lorg/ispeech/SpeechSynthesis;
05-31 13:41:23.218: D/dalvikvm(271): VFY: replacing opcode 0x71 at 0x0000
05-31 13:41:23.228: W/dalvikvm(271): VFY: unable to resolve exception class 37 (Lorg/ispeech/error/InvalidApiKeyException;)
05-31 13:41:23.228: W/dalvikvm(271): VFY: unable to find exception handler at addr 0x11
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejected Lorg/ispeech/sdksample/TTSActivity;.prepareTTSEngine ()V
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejecting opcode 0x0d at 0x0011
05-31 13:41:23.228: W/dalvikvm(271): VFY: rejected Lorg/ispeech/sdksample/TTSActivity;.prepareTTSEngine ()V
05-31 13:41:23.228: W/dalvikvm(271): Verifier rejected class Lorg/ispeech/sdksample/TTSActivity;
05-31 13:41:23.228: W/dalvikvm(271): Class init failed in newInstance call (Lorg/ispeech/sdksample/TTSActivity;)
05-31 13:41:23.228: D/AndroidRuntime(271): Shutting down VM
05-31 13:41:23.228: W/dalvikvm(271): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-31 13:41:23.248: E/AndroidRuntime(271): FATAL EXCEPTION: main
05-31 13:41:23.248: E/AndroidRuntime(271): java.lang.VerifyError: org.ispeech.sdksample.TTSActivity
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.Class.newInstanceImpl(Native Method)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.Class.newInstance(Class.java:1429)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.os.Looper.loop(Looper.java:123)
05-31 13:41:23.248: E/AndroidRuntime(271): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.reflect.Method.invokeNative(Native Method)
05-31 13:41:23.248: E/AndroidRuntime(271): at java.lang.reflect.Method.invoke(Method.java:521)
05-31 13:41:23.248: E/AndroidRuntime(271): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-31 13:41:23.248: E/AndroidRuntime(271): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-31 13:41:23.248: E/AndroidRuntime(271): at dalvik.system.NativeStart.main(Native Method)
can someone help me solve this?
This thread on their forums seems to answer your question:
http://www.ispeech.org/forums/showthread.php/942-Verify-Error

Categories

Resources