I'm programming a new app and I was trying with different versions. When I try in Nougat, my app doesn't open. It just says:
app has stopped. Open app again?
If I press open again, the app keeps stopping.
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "2.0"
multiDexEnabled true
}
}
I tried with buildToolsVersion "25.0.1" and nope. Any help?
Here is my logcat trace when I try to open it in a Nougat device
05-10 09:49:35.119 4709-4709/app E/app: /storage/emulated/0/app/Registros/grupo-registros.csv (No such file or directory)
java.io.FileNotFoundException: /storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:140)
at app.MainActivity.onCreate(MainActivity.java:175)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-10 09:49:35.148 4709-4709/app D/AndroidRuntime: Shutting down VM
05-10 09:49:35.148 4709-4709/app E/AndroidRuntime: FATAL EXCEPTION: main
Process: app, PID: 4709
java.lang.RuntimeException: Unable to start activity ComponentInfo{es/app.MainActivity}: java.util.EmptyStackException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.util.EmptyStackException
at app.MainActivity.copyFileOrDir(MainActivity.java:434)
at app.MainActivity.addSubjectDemo(MainActivity.java:341)
at app.MainActivity.onCreate(MainActivity.java:231)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
EDIT: my manifest´s permission request
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
java.io.FileNotFoundException:/storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
That happens probably because in Nougat-Android 7.0 there are changes to permissions that may affect your app. It is not enforced, but it pops exception which you probably don't handle. You should read the documentation:
https://developer.android.com/about/versions/nougat/android-7.0-changes.html
And check this answers
Android 7.1 Write to text file
Related
I get the next message from logcat afyter trying to run my app in andorid studio:
5545-5545/com.example.reyesdelafter E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.reyesdelafter, PID: 5545
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.reyesdelafter/com.example.reyesdelafter.MainActivity}: java.lang.InstantiationException: java.lang.Class cannot be instantiated
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.InstantiationException: java.lang.Class cannot be instantiated
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Also y get the message: "E/art: Failed sending reply to debugger: Broken pipe" before that, my code is exactly the same as in the beginning (and it runned well in the emulator, but I do some tries to change the icons of bottom nav view, and some other things but I get back everything to normality (or so I thought ) and it does not run properly. What is the possible problem ? I alredy tried to uprgrade SDK tools, and make sure my Manifest.xml includes my main activity.
The app has just the splash screen and login with Firebase alredy well done and it runned well before that. Thanks
Firebase Messaging Service is Causing Crash in My App. When i Implement FirebaseMessagingService and try to add it on Manifest its showing me "MyFirebaseMessagingServiceservice is not assignable to android.app.service" . When I didn't use the MyFirebaseMessagingServiceservice , then also im getting the error. This question is asked before, I have tried all the answer given in that question but noting workout. Please help.
Im using firebase-messaging:17.1.0
This is the error-
java.lang.IllegalAccessError: com.example.genesishospital.MyFirebaseMessagingService
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3838)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
After adding this permission my app works fine.
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
I try to read/write a file data_quizz.xml situated in /data/data/com.my.package.app/files/data_quizz.xml. Using other topic I used adb to make /data and all subfolders in the data_quizz.xml path 777.
But when it comes to this line :
FileInputStream is = new FileInputStream("/data/data/com.my.package.app/files/data_quizz.xml");
I still get an error, this is the stacktrace :
java.io.FileNotFoundException: /data/data/com.my.package.app/files/data_quizz.xml (Permission denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:99)
at com.dautry.a16126734.quizzapp.XmlManager.<init>(XmlManager.java:43)
at com.dautry.a16126734.quizzapp.ChooseTopic.onCreate(ChooseTopic.java:27)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Edit : Correction of the initial path which were wrong
Thanks
I get the following crash when using animated vector drawable - my setup is
Devices tested on Nougat 7.1.1 - Oneplus 3 , Oneplus one , Nexus 6 (api 25) emulator
My code was working fine earlier , now it seems to be broken , I'm Unable to start my Activity.
// Sdk and tools
minSdkVersion = 21
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = '25.0.1'
// Java
targetJVM = 1.8
// App dependencies
supportLibraryVersion = '25.1.1'
Process: techgravy.nextstop, PID: 30215
java.lang.RuntimeException: Unable to start activity ComponentInfo{techgravy.nextstop/techgravy.nextstop.ui.search.SearchActivity}: android.view.InflateException: Could not instantiate class android.transition.Transition class techgravy.nextstop.ui.transitions.StartAnimatable
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2728)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6290)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.view.InflateException: Could not instantiate class android.transition.Transition class techgravy.nextstop.ui.transitions.StartAnimatable
at android.transition.TransitionInflater.createCustom(TransitionInflater.java:227)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:171)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:185)
at android.transition.TransitionInflater.inflateTransition(TransitionInflater.java:79)
at com.android.internal.policy.PhoneWindow.getTransition(PhoneWindow.java:2799)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2762)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:413)
at android.app.Activity.setContentView(Activity.java:2444)
at techgravy.nextstop.ui.search.SearchActivity.onCreate(SearchActivity.java:120)
at android.app.Activity.performCreate(Activity.java:6760)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2681)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6290)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.transition.TransitionInflater.createCustom(TransitionInflater.java:218)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:171)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:185)
at android.transition.TransitionInflater.inflateTransition(TransitionInflater.java:79)
at com.android.internal.policy.PhoneWindow.getTransition(PhoneWindow.java:2799)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2762)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:413)
at android.app.Activity.setContentView(Activity.java:2444)
at techgravy.nextstop.ui.search.SearchActivity.onCreate(SearchActivity.java:120)
at android.app.Activity.performCreate(Activity.java:6760)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2681)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6290)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.content.res.Resources$NotFoundException: Drawable techgravy.nextstop:drawable/avd_back_to_search with resource ID #0x7f02005b
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/avd_back_to_search.xml from drawable resource ID #0x7f02005b
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:725)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571)
at android.content.res.Resources.loadDrawable(Resources.java:858)
at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
at techgravy.nextstop.ui.transitions.StartAnimatable.<init>(StartAnimatable.java:54)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.transition.TransitionInflater.createCustom(TransitionInflater.java:218)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:171)
at android.transition.TransitionInflater.createTransitionFromXml(TransitionInflater.java:185)
at android.transition.TransitionInflater.inflateTransition(TransitionInflater.java:79)
at com.android.internal.policy.PhoneWindow.getTransition(PhoneWindow.java:2799)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2762)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:413)
at android.app.Activity.setContentView(Activity.java:2444)
at techgravy.nextstop.ui.search.SearchActivity.onCreate(SearchActivity.java:120)
at android.app.Activity.performCreate(Activity.java:6760)
03-18 21:08:32.840 30215-30215/techgravy.nextstop E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2681)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6290)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.graphics.drawable.VectorDrawable
at android.graphics.drawable.AnimatedVectorDrawable.inflate(AnimatedVectorDrawable.java:471)
at android.graphics.drawable.DrawableInflater.inflateFromXml(DrawableInflater.java:130)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1227)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1200)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:715)
... 27 more
res/drawable/avd_back_to_search.xml
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="#drawable/searchback_back">
<target
android:name="arrow_head"
android:animation="#animator/searchback_hide_arrow_head_move" />
<target
android:name="arrow_head_top"
android:animation="#animator/searchback_hide_arrow_head" />
<target
android:name="arrow_head_bottom"
android:animation="#animator/searchback_hide_arrow_head" />
<target
android:name="stem"
android:animation="#animator/searchback_stem_back_to_search" />
<target
android:name="search_circle"
android:animation="#animator/searchback_show_circle" />
</animated-vector>
I have the following exception when launching my ap on API 22 and below (works very well on API 24, the target and compile API).
10-06 10:08:57.919 5014-5014/? E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/ads/conversiontracking/AdWordsConversionReporter;
at com.myapp.androidapp.ui.splash.SplashActivity.onResume(SplashActivity.java:57)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1241)
at android.app.Activity.performResume(Activity.java:6019)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2940)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2982)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.ads.conversiontracking.AdWordsConversionReporter" on path: DexPathList[[zip file "/data/app/com.myapp.androidapp.preprod.debug-2/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.androidapp.preprod.debug-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.myapp.androidapp.ui.splash.SplashActivity.onResume(SplashActivity.java:57)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1241)
at android.app.Activity.performResume(Activity.java:6019)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2940)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2982)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Suppressed: java.lang.ClassNotFoundException: com.google.ads.conversiontracking.AdWordsConversionReporter
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 16 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
It moves on another class if I comment the line where I use AdWordsConversionReporter (it can be library class or custom class).
Seems to be related with Multidexing but I'm pretty sure I'm using it well.
In my gradle I have this following lines :
multiDexEnabled true
and
compile('com.android.support:multidex:1.0.1') {
exclude group: 'com.android.support'
}
Here is a part of my application class:
public class MyApplication extends MultiDexApplication {
..
}
And a part of my manifest :
<application
android:name=".ui.MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme"
tools:replace="android:theme">
I tried a lot of solution found here on a lot of questions looking similar like adding MultiDex.install(this) on my Application class, clean my project, re-sync Gradle, enable minify on my gradle (and a lot more) but nothing works.
Any solution to resolve it ?
Works by adding
preDexLibraries false
to my gradle.