Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App won't launch on Android 22 device #592

Closed
gergderkson opened this issue Oct 20, 2016 · 10 comments
Closed

App won't launch on Android 22 device #592

gergderkson opened this issue Oct 20, 2016 · 10 comments
Assignees
Milestone

Comments

@gergderkson
Copy link

Executing a NativeScript app onto a custom android device running Android 22 is producing the following errors.

Anyone any ideas how to resolve this?

  • CLI: 2.4.0-2016-09-21-6710
  • Cross-platform modules: 2.5.0-2016-10-20-4499
  • Runtime(s): 2.5.0-next-2016-10-19-1290
E/AndroidRuntime( 4100): FATAL EXCEPTION: main
E/AndroidRuntime( 4100): Process: org.nativescript.Appointedd, PID: 4100
E/AndroidRuntime( 4100): java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 4100):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556)
E/AndroidRuntime( 4100):    at android.app.ActivityThread.access$1500(ActivityThread.java:151)
E/AndroidRuntime( 4100):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime( 4100):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4100):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 4100):    at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime( 4100):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4100):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 4100):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime( 4100):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/AndroidRuntime( 4100): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 4100):    at com.tns.Util.isPositive(Util.java:117)
E/AndroidRuntime( 4100):    at com.tns.LogcatLogger.initLogging(LogcatLogger.java:44)
E/AndroidRuntime( 4100):    at com.tns.LogcatLogger.<init>(LogcatLogger.java:14)
E/AndroidRuntime( 4100):    at com.tns.RuntimeHelper.initRuntime(RuntimeHelper.java:56)
E/AndroidRuntime( 4100):    at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:15)
E/AndroidRuntime( 4100):    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
E/AndroidRuntime( 4100):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
E/AndroidRuntime( 4100):    ... 9 more
@gergderkson
Copy link
Author

I commented out the following in the file LogcatLogger.java and the app executes without crashing. Obviously this isn't an ideal workaround, any ideas how this can be resolved properly?

    private void initLogging(Context context)
    {
        boolean isDebuggableApp = AndroidJsDebugger.isDebuggableApp(context);
        if (isDebuggableApp)
        {
            String verboseLoggingProp = Util.readSystemProperty("nativescript.verbose.logging");

            // if (Util.isPositive(verboseLoggingProp))
            // {
                setEnabled(true);
            // }
        }
    }
}

@Plamen5kov
Copy link
Contributor

Hi @gergderkson,
Can you be more specific by providing us with the steps to reproduce your problem, so we can help you.

@Plamen5kov Plamen5kov added the bug label Oct 25, 2016
@gergderkson
Copy link
Author

Yeah sure. I'm only seeing this happen a certain device. It happens for all NativeScript apps, I tried deploying a basic hello world app and got the same thing.

It looks like its related to Util.readSystemProperty("nativescript.verbose.logging") not returning a bool perhaps? I'm not too experienced with Java but do you think this could be the case?

@Plamen5kov
Copy link
Contributor

@gergderkson can you tell me what is the "certain device" you're speaking of? What model, api level?
Furthermore, It would be very helpful if you could provide a way for us to reproduce the problem.

@gergderkson
Copy link
Author

gergderkson commented Oct 26, 2016

@Plamen5kov It's a custom "till" system running Android 5.1.1. The model number probably wont help as its a custom device, but it's MTPT10

@gergderkson
Copy link
Author

@Plamen5kov I'm not sure how to exactly provide a way to replicate the problem. I can't replicate this on any other device

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Oct 26, 2016

@gergderkson if the device is some kind of payment terminal, as I understand, it might have some components stripped from the original android image.
First thing that comes to mind is checking if /system/bin/getprop exists on the device in question, because our implementation depends on it as you can see here. It returns null, because of an IOException and then we try to read the null value here, hence the error Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference.

You can check that by running adb shell and once you're in the device, you can check if getprop is there.

ls -la /system/bin/ | grep getprop

@Plamen5kov Plamen5kov self-assigned this Oct 26, 2016
@gergderkson
Copy link
Author

gergderkson commented Oct 26, 2016

@Plamen5kov Cool thanks for that.

The output of that on the device had this line within it:
lrwxr-xr-x root shell 2016-09-22 12:40 getprop -> toolbox

Plamen5kov added a commit that referenced this issue Oct 26, 2016
@Plamen5kov
Copy link
Contributor

@gergderkson there is a fix in master. But besides that, until I have a device having the same problem, that's all we can do.

@Plamen5kov Plamen5kov added this to the 2.4.0 milestone Oct 26, 2016
@gergderkson
Copy link
Author

@Plamen5kov I just pulled that down and ran a build and it works perfectly! Thanks a lot for your help, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants