Open archie94 opened 7 years ago
@archie94, I tried repeating on my device Moto G3 API 6.0.1, its not crashing even not for the first time. It may be problem with some devices. You can make a pr for the fix.
@archie94 , Is there any process in this issue?
@opticod Extremely sorry for such a late reply! Last few weeks have been busy for me.
Yes, this problem is definitely a regular in CM, not so in other devices running OxygenOS or any version of android. I was thinking of asking for permissions right after the tutorial instead of project creation. Yet to test this and will definitely make a pr after this weekend!
@archie94 Cool. U mean by adding it in template list ? Can you analyse a bit, why its showing error for CM devices but not for other devices ?
@opticod The problem does not appear to be the place where the permission is asked. You see when permission in granted we are explicitly creating a new instance of Toolkit application.
At least in CM the new instance gives java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getFilesDir()' on a null object reference
. The Application
instance crashes then restarts and works fine after this. I have tried not creating a new instance of Application
after receiving the permissions from user. However it seems doing that we are unable to write to external storage and all our project is being saved at the private directory of application.
So in CM, we are unable to create a new instance of Application
as it crashes with the error. Using the same instance of Application
does not seem to reflect the grant of permission until the app is restarted by the user. Give me a few days as to see why other devices are not behaving like this. Thanks!
@archie94 Cool, thats'why i asked for a depth analysis of the problem. Let us know once you are done.
After installation when we try to create an app from a template the app crashes after asking for read-write permissions and we are back at the TemplateActivity. It works fine from here so the crash is probably due to some storage anomalies. Found on CyanogenMod v13 (Android 6.0.1)