Google Play Services/Maps NoClassDefFoundError - java

I implemented the Google Maps tutorial from this link. But I'm getting a runtime error and the app crashes. Please help me.I followed other similar questions but haven't been able to find a solution. The issue seems to be after I updated Google Play Services.
Main Activity:
package com.example.sahayog;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
.title("Hamburg"));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("Kiel")
.snippet("Kiel is cool")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Logcat:
03-06 12:21:26.660: E/AndroidRuntime(12319): FATAL EXCEPTION: main
03-06 12:21:26.660: E/AndroidRuntime(12319): Process: com.example.sahayog, PID: 12319
03-06 12:21:26.660: E/AndroidRuntime(12319): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/model/LatLng;
03-06 12:21:26.660: E/AndroidRuntime(12319): at com.example.sahayog.MainActivity.<clinit>(MainActivity.java:16)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.reflect.Constructor.newInstance(Native Method)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.Class.newInstance(Class.java:1572)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.ActivityThread.access$800(ActivityThread.java:144)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.os.Handler.dispatchMessage(Handler.java:102)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.os.Looper.loop(Looper.java:135)
03-06 12:21:26.660: E/AndroidRuntime(12319): at android.app.ActivityThread.main(ActivityThread.java:5221)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.reflect.Method.invoke(Native Method)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.reflect.Method.invoke(Method.java:372)
03-06 12:21:26.660: E/AndroidRuntime(12319): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-06 12:21:26.660: E/AndroidRuntime(12319): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-06 12:21:26.660: E/AndroidRuntime(12319): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.model.LatLng" on path: DexPathList[[zip file "/data/app/com.example.sahayog-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
03-06 12:21:26.660: E/AndroidRuntime(12319): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-06 12:21:26.660: E/AndroidRuntime(12319): ... 15 more
03-06 12:21:26.660: E/AndroidRuntime(12319): Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.maps.model.LatLng
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.Class.classForName(Native Method)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-06 12:21:26.660: E/AndroidRuntime(12319): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-06 12:21:26.660: E/AndroidRuntime(12319): ... 16 more
03-06 12:21:26.660: E/AndroidRuntime(12319): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Try this:
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if(status!=ConnectionResult.SUCCESS)
{
// Google Play Services are not available
Toast.makeText(mContext, "Please install a maps application", Toast.LENGTH_LONG).show();
}
else
{
// Google Play Services are available
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
.title("Hamburg"));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("Kiel")
.snippet("Kiel is cool")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}

Related

networkInfo.isConnected() error

I'm receiving an error when executing this code.
When connected to wifi, the function should display MAC address, otherwise "---"
private void DisplayWifiStatus() {
ConnectivityManager conMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = conMgr.getActiveNetworkInfo();
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo();
if (networkInfo.isConnected()) {
textMac.setText(info.getMacAddress());
}else {
textMac.setText("-----");
}
}
Logcat/Stacktrace:
03-11 21:32:07.532 3348-3348/com.light87sakurahimegmail.wifiscanner E/dalvikvm﹕ >>>>> Normal User
03-11 21:32:07.532 3348-3348/com.light87sakurahimegmail.wifiscanner E/dalvikvm﹕ >>>>> com.light87sakurahimegmail.wifiscanner [ userId:0 | appId:10337 ]
03-11 21:32:07.782 3348-3348/com.light87sakurahimegmail.wifiscanner E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.light87sakurahimegmail.wifiscanner, PID: 3348
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.light87sakurahimegmail.wifiscanner/com.light87sakurahimegmail.wifiscanner.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.access$800(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.light87sakurahimegmail.wifiscanner.MainActivity.DisplayWifiStatus(MainActivity.java:79)
at com.light87sakurahimegmail.wifiscanner.MainActivity.onCreate(MainActivity.java:43)
at android.app.Activity.performCreate(Activity.java:5389)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350)
            at android.app.ActivityThread.access$800(ActivityThread.java:163)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:157)
            at android.app.ActivityThread.main(ActivityThread.java:5335)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
            at dalvik.system.NativeStart.main(Native Method)

Create Custom View and Add to XML

I have created a custom View which draws a line:
public class DrawView extends View {
Paint paint = new Paint();
public DrawView(Context context) {
super(context);
paint.setColor(Color.BLACK);
}
#Override
public void onDraw(Canvas canvas) {
canvas.drawLine(0, 0, 100, 100, paint);
}
}
I have a MainActivity class and activity_main layout where my layout contains an image and several buttons. I want to put the custom view that I created to my XML file(activity_main) where a line would be drawn on top of the image.
I tried adding it:
<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">
//imageview and buttons here
<com.myapp.alphasickbro.myapplication2.DrawView
android:id="#+id/paintView"
android:layout_width="100dp"
android:layout_height="100dp"
/>
</RelativeLayout>
Here is my MainActivity:
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
But when I run it, the app unfortunately stops. Did I miss something? What lines of code should I add?
Any answer would be appreciated
EDIT:
04-18 15:24:47.517 26732-26732/com.myapp.alphasickbro.myapplication2 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myapp.alphasickbro.myapplication2, PID: 26732
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.alphasickbro.myapplication2/com.myapp.alphasickbro.myapplication2.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class com.myapp.alphasickbro.myapplication2.DrawView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5268)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.myapp.alphasickbro.myapplication2.DrawView
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:2002)
at com.myapp.alphasickbro.myapplication2.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:5411)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5268)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:2002)
            at com.myapp.alphasickbro.myapplication2.MainActivity.onCreate(MainActivity.java:15)
            at android.app.Activity.performCreate(Activity.java:5411)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5268)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.myapp.alphasickbro.myapplication2.DrawView.<init>(DrawView.java:27)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at android.view.LayoutInflater.createView(LayoutInflater.java:594)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
            at android.app.Activity.setContentView(Activity.java:2002)
            at com.myapp.alphasickbro.myapplication2.MainActivity.onCreate(MainActivity.java:15)
            at android.app.Activity.performCreate(Activity.java:5411)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:149)
            at android.app.ActivityThread.main(ActivityThread.java:5268)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
            at dalvik.system.NativeStart.main(Native Method)
I think you need to add the missing constructors. Clean your project.
public class DrawView extends View {
Paint paint;
public DrawView(Context context) {
super(context);
init();
}
public DrawView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public DrawView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
paint = new Paint();
paint.setColor(Color.BLACK);
}
}

I get an error when running PreferenceManager.setDefaultValues on a Sony D2203 but it works when running it on my Sony D2403

The Sony D2203 runs Android 4.4.2 and the D2403 runs Android 4.4.4.
The specific line in the code that is giving the error is:
PreferenceManager.setDefaultValues(this,R.xml.preference,false);
This Is the logcat output of the error:
4-22 13:13:42.542 24913-24913/petra.com.wecapture E/AndroidRuntime? FATAL EXCEPTION: main
Process: petra.com.wecapture, PID: 24913
java.lang.RuntimeException: Unable to start activity ComponentInfo{petra.com.wecapture/petra.com.wecapture.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class petra.com.settings.MyEditTextPreference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296)
at android.app.ActivityThread.access$800(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5136)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:819)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class petra.com.settings.MyEditTextPreference
at android.preference.GenericInflater.createItem(GenericInflater.java:386)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)
at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)
at petra.com.wecapture.MainActivity.onCreate(MainActivity.java:221)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5136)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:819)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
at java.lang.Class.getConstructorOrMethod(Class.java:472)
at java.lang.Class.getConstructor(Class.java:446)
at android.preference.GenericInflater.createItem(GenericInflater.java:377)
            at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
            at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
            at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
            at android.preference.GenericInflater.inflate(GenericInflater.java:326)
            at android.preference.GenericInflater.inflate(GenericInflater.java:263)
            at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
            at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)
            at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)
            at petra.com.wecapture.MainActivity.onCreate(MainActivity.java:221)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5136)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:819)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
            at dalvik.system.NativeStart.main(Native Method)
device not found
Here is the MyEditTextPreference class:
import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
public class MyEditTextPreference extends EditTextPreference {
public MyEditTextPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
#Override
public void setText(String text) {
super.setText(text);
setSummary(text);
}
}
The preference XML file:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="App settings"
android:key="pref_key_storage_settings">
<petra.com.settings.MyEditTextPreference
android:key="pref_serverpath"
android:title="Server address"
android:defaultValue="http://192.168.0.1/"
/>
<petra.com.settings.MyEditTextPreference
android:key="pref_servicename"
android:title="Service Name"
android:defaultValue="Service1.svc"
/>
<CheckBoxPreference
android:key="pref_firstrun"
android:title="firstrun"
android:defaultValue="true"
/>
</PreferenceCategory>
<PreferenceCategory
android:title="Local Database Tools"
android:key="pref_key_db_settings">
<Preference
android:key="pref_clean_db"
android:title="Clean database"
android:summary="All data in local database will be lost."
android:enabled="true">
</Preference>
</PreferenceCategory>
</PreferenceScreen>
Does anyone know why I would get this problem? I can't find anything to help on the web. It seems like there must be some compatibility issue with my code between Android 4.4.2 and Android 4.4.4 but I don't know what it is.
Seems to me that different API versions use different default constructors of the Preference object when it is inflated from XML. You should always implement all default constructors whan subclassing inflated android objects. Your MyEditTextPreference should look like this
public class MyEditTextPreference extends EditTextPreference {
public MyEditTextPreference(Context context) {
super(context);
}
public MyEditTextPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyEditTextPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
#Override
public void setText(String text) {
super.setText(text);
setSummary(text);
}
}

NullPointerException for OnClickListener android Java

I feel bad for asking about this but for 2 hours now I can't find any way to solve this:
**The Problem: ** I have set up a canvas area(where i plot a drawable figure) and a button below the canvas area.
In my AnimatedView class I want find the button and give it an onClickListener, but it returns a NullPointerException.
my activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical"
android:background="#000000">
<com.example.julle.bounce.AnimatedView
android:id="#+id/anim_view"
android:layout_height="300dp"
android:layout_width="fill_parent"/>
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/anim_view"
android:id="#+id/button_jump"
android:clickable="true"
android:text="Jump"/>
my code for AnimatedView.java:
package com.example.julle.bounce;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class AnimatedView extends ImageView{
private Context mContext;
int x = -1;
int y = -1;
private int xVelocity = 10;
private int yVelocity = 5;
private Handler h;
private final int FRAME_RATE = 30;
boolean jump=false;
public AnimatedView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
final Button button = (Button) findViewById(R.id.button_jump);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
jump=true;
}
});
h = new Handler();
}
private Runnable r = new Runnable() {
#Override
public void run() {
invalidate();
}
};
protected void onDraw(Canvas c) {
BitmapDrawable ball = (BitmapDrawable) mContext.getResources().getDrawable(R.drawable.ball);
if(jump==true) {
if (y < 0) {
y = this.getHeight() / 2;
} else {
y += yVelocity;
}
jump=false;
}else{
y= this.getHeight()/2;
}
c.drawBitmap(ball.getBitmap(), x, y, null);
h.postDelayed(r, FRAME_RATE);
}
}
and my MainActivity:
package com.example.julle.bounce;
import ...
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I believe I've realised the problem: the buttons are existent in the MainActivity class but not in my AnimatedView class. Allthou it might be very simple, I'm not sure how to solve that.
Thank you for all replies!
Sorry, totally forgot that I changed the code. AnimatedView is updated:
The line that gives NullPointException is line 26 in AnimatedView: button.setOnClickListener...
logcat:
02-24 14:47:32.005 31934-31934/com.example.julle.bounce E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.julle.bounce/com.example.julle.bounce.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.example.julle.bounce.AnimatedView
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 #13: Error inflating class com.example.julle.bounce.AnimatedView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
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 android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at com.example.julle.bounce.MainActivity.onCreate(MainActivity.java:23)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
            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: 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)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
            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 android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at com.example.julle.bounce.MainActivity.onCreate(MainActivity.java:23)
            at android.app.Activity.performCreate(Activity.java:5206)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
            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: java.lang.NullPointerException
at com.example.julle.bounce.AnimatedView.<init>(AnimatedView.java:26)
            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)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
            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 android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at com.example.julle.bounce.MainActivity.onCreate(MainActivity.java:23)
            at android.app.Activity.performCreate(Activity.java:5206)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
            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)
You can pass a reference to your button from main activity to AnimatedView class.
package com.example.julle.bounce;
import ...
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button)findViewByID(R.id.button_jump);
AnimatedView av = (AnimatedView)findViewByID(R.id.anm_view);
av.setJumpButton(btn);
}
}
You will need to add the setJumpButton method in your AnimatedView class.

Why cant my view flipper show more than 3 views?

I am trying to make a slideshow app for a school project, and I have it working when the view flipper contains 3 images. However, when I add a 4th layout and another picture the program crashes.
Any idea why? Thanks!
public class MainActivity extends Activity {
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private ViewFlipper myViewFlipper;
private AnimationListener mAnimationListener;
private Context mContext;
MediaPlayer soundOne, soundTwo, soundThree;
#SuppressWarnings("deprecation")
private final GestureDetector detector = new GestureDetector(new SwipeGestureDetector());
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
myViewFlipper = (ViewFlipper) this.findViewById(R.id.view_flipper);
myViewFlipper.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(final View view, final MotionEvent event) {
detector.onTouchEvent(event);
return true;
}
});
findViewById(R.id.play).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
//sets auto flipping
myViewFlipper.setAutoStart(true);
myViewFlipper.setFlipInterval(4000);
myViewFlipper.startFlipping();
soundOne = MediaPlayer.create(MainActivity.this, R.raw.one );
soundTwo = MediaPlayer.create(MainActivity.this, R.raw.two );
soundThree = MediaPlayer.create(MainActivity.this, R.raw.three );
//generate random number
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(3) + 1;
//picking the right sound to play
switch (randomInt){
case 1: soundOne.start();
break;
case 2: soundTwo.start();
break;
case 3: soundThree.start();
break;
}
}
});
findViewById(R.id.stop).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
//stop auto flipping
myViewFlipper.stopFlipping();
soundOne.stop();
soundTwo.stop();
soundThree.stop();
}
});
//animation listener
mAnimationListener = new Animation.AnimationListener() {
public void onAnimationStart(Animation animation) {
//animation started event
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
//TODO animation stopped event
}
};
}
class SwipeGestureDetector extends SimpleOnGestureListener {
#Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
try {
// right to left swipe
if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
myViewFlipper.setInAnimation(loadAnimation(mContext, R.anim.abc_fade_in));
myViewFlipper.setOutAnimation(loadAnimation(mContext, R.anim.abc_fade_out));
// controlling animation
myViewFlipper.getInAnimation().setAnimationListener(mAnimationListener);
myViewFlipper.showNext();
return true;
} else
if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
myViewFlipper.setInAnimation(loadAnimation(mContext, R.anim.abc_slide_in_top));
myViewFlipper.setOutAnimation(loadAnimation(mContext, R.anim.abc_slide_out_bottom));
// controlling animation
myViewFlipper.getInAnimation().setAnimationListener(mAnimationListener);
myViewFlipper.showPrevious();
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
}
I don't know why but when I've looked at the logcat it's referring to the layout file 'activity_main'. I've look at it and can't see why it's not working as previously I had 3 relative layouts and changed it to 4.
here is logcat
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide E/Trace﹕ error opening trace file: No such file or directory (2)
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapUtilization:0.25
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapIdealFree:8388608
03-06 17:29:08.973 32420-32420/firstapp.imageslide.imageslide D/ActivityThread﹕ setTargetHeapConcurrentStart:2097152
03-06 17:29:09.583 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed 87K, 10% free 17905K/19779K, paused 60ms, total 60ms
03-06 17:29:09.653 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 38.204MB for 12544016-byte allocation
03-06 17:29:09.673 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 1K, 6% free 30153K/32071K, paused 8ms+2ms, total 25ms
03-06 17:29:09.793 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 23% free 30155K/38983K, paused 12ms+3ms, total 30ms
03-06 17:29:09.903 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 23% free 30155K/38983K, paused 16ms, total 16ms
03-06 17:29:09.963 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 50.166MB for 12544016-byte allocation
03-06 17:29:10.003 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed <1K, 18% free 42405K/51271K, paused 11ms+3ms, total 32ms
03-06 17:29:10.093 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 18% free 42407K/51271K, paused 2ms+5ms, total 41ms
03-06 17:29:10.163 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 18% free 42407K/51271K, paused 18ms, total 18ms
03-06 17:29:10.243 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Grow heap (frag case) to 62.131MB for 12544016-byte allocation
03-06 17:29:10.313 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed <1K, 15% free 54657K/63559K, paused 12ms+6ms, total 66ms
03-06 17:29:10.573 32420-32424/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_CONCURRENT freed 6890K, 15% free 54659K/63559K, paused 12ms+4ms, total 46ms
03-06 17:29:10.653 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 15% free 54659K/63559K, paused 16ms, total 16ms
03-06 17:29:10.653 32420-32420/firstapp.imageslide.imageslide I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 12544016-byte allocation
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide D/dalvikvm﹕ GC_BEFORE_OOM freed 8K, 15% free 54650K/63559K, paused 25ms, total 25ms
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide E/dalvikvm-heap﹕ Out of memory on a 12544016-byte allocation.
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ "main" prio=5 tid=1 RUNNABLE
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x40c585e0 self=0x400c70d8
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | sysTid=32420 nice=0 sched=0/0 cgrp=apps handle=1075144752
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ | schedstat=( 0 0 0 ) utm=64 stm=33 core=1
03-06 17:29:10.673 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-06 17:29:10.693 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-06 17:29:10.693 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.content.res.Resources.loadDrawable(Resources.java:1935)
03-06 17:29:10.713 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:120)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:110)
03-06 17:29:10.723 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Constructor.constructNative(Native Method)
03-06 17:29:10.743 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-06 17:29:10.783 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:262)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Activity.setContentView(Activity.java:1867)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Activity.performCreate(Activity.java:5008)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.access$600(ActivityThread.java:138)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
03-06 17:29:10.813 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.os.Looper.loop(Looper.java:213)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at android.app.ActivityThread.main(ActivityThread.java:4787)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Method.invokeNative(Native Method)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at java.lang.reflect.Method.invoke(Method.java:511)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ at dalvik.system.NativeStart.main(Native Method)
03-06 17:29:10.843 32420-32420/firstapp.imageslide.imageslide I/dalvikvm﹕ [ 03-06 17:29:10.843 32420:32420 D/skia ]
--- bitmap->allocPixels failed
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide D/AndroidRuntime﹕ Shutting down VM
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40c57378)
03-06 17:29:10.893 32420-32420/firstapp.imageslide.imageslide E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{firstapp.imageslide.imageslide/firstapp.imageslide.imageslide.MainActivity}: android.view.InflateException: Binary XML file line #74: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
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:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #74: Error inflating class <unknown>
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.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
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:262)
at android.app.Activity.setContentView(Activity.java:1867)
at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
            at android.app.ActivityThread.access$600(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:4787)
            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:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
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)
            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.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            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:262)
            at android.app.Activity.setContentView(Activity.java:1867)
            at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
            at android.app.ActivityThread.access$600(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:4787)
            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:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
at android.content.res.Resources.loadDrawable(Resources.java:1935)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:120)
at android.widget.ImageView.<init>(ImageView.java:110)
            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)
            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.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            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:262)
            at android.app.Activity.setContentView(Activity.java:1867)
            at firstapp.imageslide.imageslide.MainActivity.onCreate(MainActivity.java:38)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2035)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
            at android.app.ActivityThread.access$600(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:4787)
            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:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
03-06 17:29:13.893 32420-32420/firstapp.imageslide.imageslide I/Process﹕ Sending signal. PID: 32420 SIG: 9

Categories