TypeError: activityInfo.metaData.getInt is not a function


#1

Hello, I have just started new project in NativeScript but failed run…

here is stack trace

Project successfully built.
Installing...
Successfully installed on device with identifier '561e90bc'.
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.testApplication on device 561e90bc.
ActivityManager: Start proc org.nativescript.testApplication for activity org.nativescript.testApplication/com.tns.NativeScriptActivity: pid=25973 uid=10302 gids={50302, 1028, 1015, 3003}
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.testApplication/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
System.err: Calling js method onCreate failed
System.err: TypeError: activityInfo.metaData.getInt is not a function
System.err: File: "file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18
System.err: StackTrace: 
System.err: 	Frame: function:'', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60
System.err: 	Frame: function:'', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13
System.err: 	Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19
System.err: 	Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
System.err: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
System.err: 	at android.app.ActivityThread.access$800(ActivityThread.java:141)
System.err: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
System.err: 	at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: 	at android.os.Looper.loop(Looper.java:136)
System.err: 	at android.app.ActivityThread.main(ActivityThread.java:5052)
System.err: 	at java.lang.reflect.Method.invokeNative(Native Method)
System.err: 	at java.lang.reflect.Method.invoke(Method.java:515)
System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
System.err: 	at dalvik.system.NativeStart.main(Native Method)
System.err: Caused by: com.tns.NativeScriptException: 
System.err: Calling js method onCreate failed
System.err: TypeError: activityInfo.metaData.getInt is not a function
System.err: File: "file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18
System.err: StackTrace: 
System.err: 	Frame: function:'', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60
System.err: 	Frame: function:'', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13
System.err: 	Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19
System.err: 	Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.testApplication/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25
System.err: 	at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: 	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err: 	at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: 	at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13)
System.err: 	at android.app.Activity.performCreate(Activity.java:5242)
System.err: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
System.err: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
System.err: 	... 11 more
ActivityManager: Process org.nativescript.testApplication (pid 25973) has died.
ActivityManager: cleanUpApplicationRecordLocked -- 25973


#2

Hey, and welcome to the forums, @bbdangar. Please keep the title short - helps everyone navigate the forums more easily. Please try to provide as much relevant information in your post as possible. Stating something fails is not enough with software projects - information like command executed, device/emulator your code runs on, and relevant application code, these things can help a lot in troubleshooting the problem.

Luckily (or not, depends which side you are on :wink: ), this appears to be the infamous MIUI ROM API level 19 (Xiaomi Redmi 2) incompatibility with NativeScript - https://github.com/NativeScript/android-runtime/issues/404

Short version - NativeScript doesn’t work on devices with MIUI ROM of API level 19. Use an emulator, or a more ‘standard’ android device to test your application on.

Longer version - all the info can be found in the github issue, if you are curious what’s causing it.