I'm trying to build our NativeScript app to run on my Android Studio Emulator but I keep running into this certain build error:
> Failed to build plugin nativescript-phone :
Error: spawn ./gradlew ENOENT
Exception in thread "DisconnectableInputStream source reader" org.gradle.api.UncheckedIOException: java.io.IOException: Input/output error
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:62)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:41)
at org.gradle.util.internal.DisconnectableInputStream$1.run(DisconnectableInputStream.java:127)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Input/output error
at java.base/java.io.FileInputStream.readBytes(Native Method)
at java.base/java.io.FileInputStream.read(FileInputStream.java:279)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:290)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
at org.gradle.util.internal.DisconnectableInputStream$1.run(DisconnectableInputStream.java:98)
I already tried to reinstall NativeScript, deleted my node_modules, deleted Android Studio. I've tried to delete nativescript-phone from my package.json-file, ran ns clean, ran tns debug android again but it is still not working.
My Package.json:
{
"nativescript": {
"id": "com.maxtoolbox.vrsta",
"tns-android": {
"version": "6.2.0"
},
"tns-ios": {
"version": "6.5.2"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@nativescript/theme": "~2.2.0",
"html-entities": "^2.3.2",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"nativescript-angular": "~8.20.0",
"nativescript-app-sync": "^1.0.7",
"nativescript-background-http": "^4.2.1",
"nativescript-camera": "^4.5.0",
"nativescript-datetimepicker": "^1.2.2",
"nativescript-email": "^1.5.5",
"nativescript-exit": "^1.0.1",
"nativescript-exoplayer": "^4.0.2",
"nativescript-feedback": "^1.5.0",
"nativescript-fingerprint-auth": "^7.0.2",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-pdf-view": "^2.1.0",
"nativescript-permissions": "^1.3.8",
"nativescript-phone": "^1.4.1",
"nativescript-plugin-firebase": "^10.3.0",
"nativescript-plugin-statusbar": "^1.0.19",
"nativescript-purchase": "^2.0.13",
"nativescript-simple-filepicker": "^1.0.2",
"nativescript-socket.io": "^0.11.1",
"nativescript-ui-sidedrawer": "^8.0.0",
"nativescript-videoplayer": "^4.2.1",
"nativescript-webview-interface": "^1.4.3",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.2.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular/compiler-cli": "~8.2.0",
"@ngtools/webpack": "~8.2.0",
"nativescript-dev-webpack": "~1.3.0",
"tns-android": "6.2.0",
"tns-ios": "6.5.3",
"typescript": "~3.5.3"
},
"gitHead": "a6fec076a20f898feabb4466a2c411158c18a100",
"readme": "NativeScript Application"
}
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="69"
android:versionName="7.1">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:targetSdkVersion="30"/>
<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.CAMERA"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_USER_DICTIONARY"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="Valido Mitarbeiter APP"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_brightness_1" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/ns_blue" />
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|.screenLayout|locale|uiMode"
android:theme="@style/LaunchScreenTheme"
android:windowSoftInputMode="adjustPan">
<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"/>
<service
android:name="org.nativescript.plugins.firebase.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service
android:name="org.nativescript.plugins.firebase.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>
My globally installed stuff:
NativeScript: 8.2.2
NPM: 8.5.2
Node: 17.7.1
Angular: 8.0.6
(if it's still relevant) I'm working on a device with M1-chip.
I've fixed it with upgrading to the latest NativeScript Version 8.2.3
works fine now.