Not working on android device version "4.4.4" or below


#1

I’m using version “3.0.1” and not able run app on an Android device running 4.4.4 or below and fine on emulator . And when i create newly project it show same error.

Error show like this:

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.Khallupz/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
Calling js method onCreate failed

TypeError: activityInfo.metaData.getInt is not a function
File: "file:///data/data/org.nativescript.Khallupz/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 673, column: 18

StackTrace: 
 Frame: function:'onActivityCreated', file:'file:///data/data/org.nativescript.Khallupz/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 62
 Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.Khallupz/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 673, column: 19
 Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.Khallupz/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 16, column: 25
...

package.json file

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.Khallupz",
    "tns-android": {
      "version": "3.0.1"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.1.0",
    "@angular/common": "~4.1.0",
    "@angular/compiler": "~4.1.0",
    "@angular/core": "~4.1.0",
    "@angular/forms": "~4.1.0",
    "@angular/http": "~4.1.0",
    "@angular/platform-browser": "~4.1.0",
    "@angular/router": "~4.1.0",
    "email-validator": "^1.0.7",
    "nativescript-angular": "~3.0.0",
    "nativescript-audio": "^3.4.2",
    "nativescript-drop-down": "^3.0.2",
    "nativescript-ngx-fonticon": "^2.2.1",
    "nativescript-pulltorefresh": "^2.0.0-rc.1",
    "nativescript-sound": "^1.0.4",
    "nativescript-telerik-ui": "^2.0.1",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.3.0",
    "tns-core-modules": "~3.0.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.4.0",
    "typescript": "~2.2.1"
  }
}

AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="__PACKAGE__"
    android:versionCode="1"
    android:versionName="1.0">

    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"/>

    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="__APILEVEL__"/>/>

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
        android:name="com.tns.NativeScriptApplication"
        android:allowBackup="true"
        android:icon="@drawable/logo_login"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <activity
            android:name="com.tns.NativeScriptActivity"
            android:label="@string/title_activity_kimera"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@style/LaunchScreenTheme">

            <meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.tns.ErrorReportActivity"/>
    </application>
</manifest>

#2

NativeScript does not currently support anything below 4.4; however it DOES support 4.4 and above fine. I’ve just deployed an Angular NS app to my Samsung S5 (Android 4.4) and it works fine.

You might try and quickly create a new test app tns create test --ng; with no added cod and see if it works for you. Also you might also specify which type of phone you tried. If you can duplicate this with a fresh project, then I would recommend you post the bug in bug tracker for nativescript…

Nathanael A.


#3

@NathanaelA thanks for reply . i create new test app using tns create test --ng and deployed on Xiaomi Redmi Note 4G (HM Note 1LTE) Android version “4.4.4” and it thrown same above error.


#4

Ah, yes the infamous Redmi devices. The vendor changed the Android libraries built in. See: https://github.com/NativeScript/android-runtime/issues/404 for the long running bug report on those devices… You might want to add your device to the list of devices that are crashing when using NativeScript on that report.

Nathanael A.