This is really helpful ...
I am sharing one trick who frequently face AVD issue..
Just delete avd folder inside ur ".android" folder which can be found on c:/Users/UserName ...
D/AndroidRuntime(19049): Shutting down VM
E/AndroidRuntime(19049): FATAL EXCEPTION: main
E/AndroidRuntime(19049): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cosmic.mods/com.cosmic.mods.Wallpaper}: java.lang.NullPointerException
E/AndroidRuntime(19049): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
E/AndroidRuntime(19049): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
E/AndroidRuntime(19049): at android.app.ActivityThread.access$700(ActivityThread.java:159)
E/AndroidRuntime(19049): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
E/AndroidRuntime(19049): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(19049): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(19049): at android.app.ActivityThread.main(ActivityThread.java:5419)
E/AndroidRuntime(19049): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(19049): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(19049): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
E/AndroidRuntime(19049): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/AndroidRuntime(19049): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
E/AndroidRuntime(19049): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(19049): Caused by: java.lang.NullPointerException
E/AndroidRuntime(19049): at com.cosmic.mods.Wallpaper.onCreate(Wallpaper.java:58)
E/AndroidRuntime(19049): at android.app.Activity.performCreate(Activity.java:5372)
E/AndroidRuntime(19049): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
E/AndroidRuntime(19049): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
E/AndroidRuntime(19049): ... 12 more
getSupportActionBar(). setDisplayHomeAsUpEnabled(true);
My gosh I've been wrapping the nasty ones in try/catch and shrinking it till i find the culprit, I knew about the debugger for eclipse but i thought it took more to setup. thank you sir.
This is probably the best place to ask my question, so here :
I have a ROM control app which has a wallpaper option, which works flawlessly on Gingerbread but gives a NullPointerException in ICS+
Here's the logcat
Code:D/AndroidRuntime(19049): Shutting down VM E/AndroidRuntime(19049): FATAL EXCEPTION: main E/AndroidRuntime(19049): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cosmic.mods/com.cosmic.mods.Wallpaper}: java.lang.NullPointerException E/AndroidRuntime(19049): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295) E/AndroidRuntime(19049): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) E/AndroidRuntime(19049): at android.app.ActivityThread.access$700(ActivityThread.java:159) E/AndroidRuntime(19049): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) E/AndroidRuntime(19049): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(19049): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(19049): at android.app.ActivityThread.main(ActivityThread.java:5419) E/AndroidRuntime(19049): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(19049): at java.lang.reflect.Method.invoke(Method.java:525) E/AndroidRuntime(19049): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187) E/AndroidRuntime(19049): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) E/AndroidRuntime(19049): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) E/AndroidRuntime(19049): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(19049): Caused by: java.lang.NullPointerException E/AndroidRuntime(19049): at com.cosmic.mods.Wallpaper.onCreate(Wallpaper.java:58) E/AndroidRuntime(19049): at android.app.Activity.performCreate(Activity.java:5372) E/AndroidRuntime(19049): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) E/AndroidRuntime(19049): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257) E/AndroidRuntime(19049): ... 12 more
Here's the code
https://github.com/iamareebjamal/cosmic_hub/blob/master/src/com/cosmic/mods/Wallpaper.java
The line 58, where it's showing the error is
Code:getSupportActionBar(). setDisplayHomeAsUpEnabled(true);
I understand that it may not be exact line throwing the error.
IDK what may be the problem. Stranger thing is that the same code for wallpapers work in my other app(icon pack) fine on any Android version
01-12 18:19:26.945: E/AndroidRuntime(16249): FATAL EXCEPTION: main
01-12 18:19:26.945: E/AndroidRuntime(16249): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.bel.android.dspmanager.UPDATE } in com.bel.android.dspmanager.HeadsetService$2@4050dbb0
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Handler.handleCallback(Handler.java:587)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Handler.dispatchMessage(Handler.java:92)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Looper.loop(Looper.java:130)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.ActivityThread.main(ActivityThread.java:3687)
01-12 18:19:26.945: E/AndroidRuntime(16249): at java.lang.reflect.Method.invokeNative(Native Method)
01-12 18:19:26.945: E/AndroidRuntime(16249): at java.lang.reflect.Method.invoke(Method.java:507)
01-12 18:19:26.945: E/AndroidRuntime(16249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-12 18:19:26.945: E/AndroidRuntime(16249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-12 18:19:26.945: E/AndroidRuntime(16249): at dalvik.system.NativeStart.main(Native Method)
01-12 18:19:26.945: E/AndroidRuntime(16249): Caused by: java.lang.IllegalArgumentException: AudioEffect: bad parameter value
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1179)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.media.audiofx.Equalizer.setBandLevel(Equalizer.java:229)
01-12 18:19:26.945: E/AndroidRuntime(16249): at com.bel.android.dspmanager.HeadsetService.updateDsp(HeadsetService.java:220)
01-12 18:19:26.945: E/AndroidRuntime(16249): at com.bel.android.dspmanager.HeadsetService$2.onReceive(HeadsetService.java:100)
01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
01-12 18:19:26.945: E/AndroidRuntime(16249): ... 9 more
Hi! First, awesome thread, its very helpful! I am trying to build dsp manager from source. I am using the code from cyanogenmod github (gingerbread branch). https://github.com/CyanogenMod/android_packages_apps_DSPManager/tree/gingerbread I didnt do any modifications to the code. And when I want to change equalizer settings it fcs.
Here is the log:
TIA!Code:01-12 18:19:26.945: E/AndroidRuntime(16249): FATAL EXCEPTION: main 01-12 18:19:26.945: E/AndroidRuntime(16249): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.bel.android.dspmanager.UPDATE } in com.bel.android.dspmanager.HeadsetService$2@4050dbb0 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Handler.handleCallback(Handler.java:587) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Handler.dispatchMessage(Handler.java:92) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.os.Looper.loop(Looper.java:130) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.ActivityThread.main(ActivityThread.java:3687) 01-12 18:19:26.945: E/AndroidRuntime(16249): at java.lang.reflect.Method.invokeNative(Native Method) 01-12 18:19:26.945: E/AndroidRuntime(16249): at java.lang.reflect.Method.invoke(Method.java:507) 01-12 18:19:26.945: E/AndroidRuntime(16249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 01-12 18:19:26.945: E/AndroidRuntime(16249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 01-12 18:19:26.945: E/AndroidRuntime(16249): at dalvik.system.NativeStart.main(Native Method) 01-12 18:19:26.945: E/AndroidRuntime(16249): Caused by: java.lang.IllegalArgumentException: AudioEffect: bad parameter value 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.media.audiofx.AudioEffect.checkStatus(AudioEffect.java:1179) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.media.audiofx.Equalizer.setBandLevel(Equalizer.java:229) 01-12 18:19:26.945: E/AndroidRuntime(16249): at com.bel.android.dspmanager.HeadsetService.updateDsp(HeadsetService.java:220) 01-12 18:19:26.945: E/AndroidRuntime(16249): at com.bel.android.dspmanager.HeadsetService$2.onReceive(HeadsetService.java:100) 01-12 18:19:26.945: E/AndroidRuntime(16249): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709) 01-12 18:19:26.945: E/AndroidRuntime(16249): ... 9 more
Well, I'd suggest creating a different thread for that. This one is for discussing Android debugging in general. Individual problems belong in their own threads.
AVDs
I guess that nearly every developer for Android knows them and uses them: AVDs or emulators
They are great for testing your apps on other screen sizes or platform versions.
Before releasing your app, test them on different screen sizes and (most important) on different versions of Android. Some methods are just available on new API versions and crash on old versions. Another thing to mention: If your layout is designed for large screens, it might look bad on small ones. In the same manner phone layout often look ugly on a tablet.
Creating AVDs: Official documentation
ROOTING an AVD: Guide by Androguide.fr
The question might be a bit off topic, i am working on a root app development but i am pretty confused that how should i get the busbox commands to run on button press, i have given the path and everything but how am i supposed to create a busbox file in data/data/package/files.
This part is confusing me I am not able to create that file, should i keep it in res while creating the app ? And also one last question, from where can i get that busbox file with all its command. Please help, I'm sorry if this is the wrong forum I'm new to posting questions and also to app development .
06-15 12:45:02.205 805-805/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.nikwen.myapplication/de.nikwen.myapplication.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at de.nikwen.myapplication.MainActivity.doSomething(MainActivity.java:21)
at de.nikwen.myapplication.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more
package de.nikwen.myapplication;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
public class MainActivity extends Activity {
Button myButton;
@[B][/B]Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
doSomething();
}
private void doSomething() {
myButton.setText("Crashing here");
}
}
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.nikwen.myapplication/de.nikwen.myapplication.MainActivity}: java.lang.[COLOR="Red"]NullPointerException[/COLOR]
(Source: http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/NullPointerException.html)Thrown when an application attempts to use null in a case where an object is required. These include:
- Calling the instance method of a null object.
java.lang.RuntimeException: [COLOR="Red"]Unable to start activity[/COLOR] ComponentInfo{de.nikwen.myapplication/de.nikwen.myapplication.MainActivity}: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
[COLOR="Red"]at de.nikwen.myapplication.MainActivity.doSomething(MainActivity.java:21)
at de.nikwen.myapplication.MainActivity.onCreate(MainActivity.java:17)[/COLOR]
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at de.nikwen.myapplication.MainActivity.onCreate[COLOR="Red"](MainActivity.java:17)[/COLOR]
at de.nikwen.myapplication.MainActivity.doSomething[COLOR="Red"](MainActivity.java:21)[/COLOR]
myButton.setText("Crashing here");
@[B][/B]Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myButton = (Button) findViewById(R.id.my_button);
doSomething();
}
Log.d("myTag", "myMessage");
Log.e("myTag", "myErrorMessage");
Log.d("start", "hey");
String[] myStringArray = new String[] {"Hello world", "Debugging is fun (normally not ;))", "XDA is great!!!"};
String all = "Words: ";
for (String s: myStringArray) {
Log.d("String s", s);
all = all + s + ", ";
Log.d("new all", all);
}
Log.d("status", "done");
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/start: hey
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/String s: Hello world
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/new all: Words: Hello world,
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/String s: Debugging is fun (normally not ;))
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/new all: Words: Hello world, Debugging is fun (normally not ;)),
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/String s: XDA is great!!!
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/new all: Words: Hello world, Debugging is fun (normally not ;)), XDA is great!!!,
06-15 13:15:03.014 1347-1347/de.nikwen.myapplication D/status: done
for (int i = 0; i < 20; i--) {
//do something
Log.d("i", String.valueOf(i));
}
Log.d("status", "1");
myButton.setText("New text");
Log.d("status", "2");
Log.d("status", "done");
try {
Thread.sleep(5000);
} catch(Exception e) {
e.printStackTrace();
//do something here
}