Cannot run on Android device

#1

Have a detached (ExpoKit) app and trying to run on android device. iOS runs fine (with react-native run-ios). When running react-native run-android (with a device connected, USB debug enabled) I get:

Running /Users/.../Library/Android/sdk/platform-tools/adb -s 4ad25a1d reverse tcp:8081 tcp:8081
Starting the app on 4ad25a1d (/Users/joaopedreira/Library/Android/sdk/platform-tools/adb -s 4ad25a1d shell am start -n host.exp.exponent/host.exp.exponent.MainActivity)...
Starting: Intent { cmp=host.exp.exponent/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=host.exp.exponent/.MainActivity } from null (pid=15926, uid=2000) not exported from uid 10179
	at android.os.Parcel.readException(Parcel.java:1540)
	at android.os.Parcel.readException(Parcel.java:1493)
	at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2574)
	at com.android.commands.am.Am.runStart(Am.java:740)
	at com.android.commands.am.Am.onRun(Am.java:304)
	at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
	at com.android.commands.am.Am.main(Am.java:99)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:255)

Process finished with exit code 0

Tried to set android:exported="true" in the .MainActtvity intent but that didn’t work (and it shouldn’t be necessary, since the activity has a filter and, thus, “exported” defaults to true).

Any help is appreciated.

#2

Hi @joaopiopedreira - react-native run-android cannot be used with expokit projects currently. We recommend that you open your project in Android Studio and run/build it from there, but you can also use cd android && ./gradlew installDevDebug if you prefer the command line.

We’re working on a simpler command line solution but it’s not available quite yet.

#3

Hi @esamelson, thank you for the tip. it works really well. But when I try to open the app on the device (after being successfully installed with the previous step) it just says “expo stopped” and exits. Really weird - no logs, no errors, nothing… Is this something you cam across? Cheers

#4

Hi @joaopiopedreira - hmm, that is odd :thinking: I’m unable to reproduce that behavior myself, unfortunately. Are there any obvious crashes in your device logs (adb logcat) when you try to open the device? Is it the same error that you pasted in above? Also, which SDK version are you running, and what version of Android is the device you’re testing on using?

1 Like
closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.