Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJavier Pacheco
3,963 PointsApp stopped working
I'm trying to run my app but it keeps crashing as soon as I open it. I tried using the code provided on the lesson and not my code but I got the same message. Is there something else that I should be doing? I'm using a Oneplus One so I don't know if there is a special setting that I need to change.
Javier Pacheco
3,963 PointsThe code is the same as the one provided in the zip file for the video. The logcat is just too long to post it here, I'm gonna post the first errors (I think they are repeating, probably a loop):
05-30 20:58:36.389 20088-3793/? A/libc﹕ Fatal signal 7 (SIGBUS), code 2, fault addr 0xa2060000 in tid 3793 (pool-731-thread) 05-30 22:51:18.078 6345-11090/? A/libc﹕ Fatal signal 7 (SIGBUS), code 2, fault addr 0xaf889000 in tid 11090 (pool-233-thread) 05-31 10:45:03.669 31111-31111/? E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.javierpacheco.stormy, PID: 31111 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.javierpacheco.stormy/com.example.javierpacheco.stormy.MainActivity}: java.lang.SecurityException: ConnectivityService: Neither user 10062 nor current process has android.permission.ACCESS_NETWORK_STATE. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2329) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389) at android.app.ActivityThread.access$900(ActivityThread.java:147) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10062 nor current process has android.permission.ACCESS_NETWORK_STATE. at android.os.Parcel.readException(Parcel.java:1540) at android.os.Parcel.readException(Parcel.java:1493) at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:968) at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:614) at com.example.javierpacheco.stormy.MainActivity.isNetworkAvailable(MainActivity.java:95) at com.example.javierpacheco.stormy.MainActivity.onCreate(MainActivity.java:41) at android.app.Activity.performCreate(Activity.java:5933) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389) at android.app.ActivityThread.access$900(ActivityThread.java:147) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
1 Answer
James Simshaw
28,738 PointsHello,
You're needing to add the android.permission.ACCESS_NETWORK_STATE to your manifest file. To do that, you need to add
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE />
within the manifest tags(should be near the top) of your AndroidManifest.xml file. For more information about Android's permissions please reference this page. Please let us know if this helps or if you need more assistance and we can help you further. If you are needing more assistance, please provide your AndroidManfiest.xml file, along with any error message you get if they are different from the one already posted.
Javier Pacheco
3,963 PointsThank you very much! After all, I was going to add that line only to find out it was on lower case. Apparently the names of the uses permission tags are case sensitive.
James Simshaw
28,738 PointsYou're welcome. Have fun with Android development.
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsHello,
Could you post the output in Logcat, it should be in the area at the bottom of Android Studio, as well as your code so that we can help you find your error?