为什么 nativescript-phone(构建插件失败)在 Android 上不起作用?
Why is nativescript-phone (failed to build plugin) not working on Android?
我正在尝试在我的 Android Studio 模拟器上将我们的 NativeScript 应用程序构建到 运行,但我一直 运行 遇到这个特定的构建错误:
> 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.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.run(DisconnectableInputStream.java:98)
我已经尝试重新安装 NativeScript,删除了我的 node_modules,删除了 Android Studio。我已经尝试从我的 package.json 文件中删除 nativescript-phone,运行 ns clean,运行 tns debug android,但它仍然无法正常工作.
我的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"
}
我的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>
我全局安装的东西:
NativeScript: 8.2.2
NPM: 8.5.2
Node: 17.7.1
Angular: 8.0.6
(如果它仍然相关)我正在开发带有 M1 芯片的设备。
我已经通过升级到最新的 NativeScript 版本 8.2.3 修复了它
现在工作正常。
我正在尝试在我的 Android Studio 模拟器上将我们的 NativeScript 应用程序构建到 运行,但我一直 运行 遇到这个特定的构建错误:
> 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.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.run(DisconnectableInputStream.java:98)
我已经尝试重新安装 NativeScript,删除了我的 node_modules,删除了 Android Studio。我已经尝试从我的 package.json 文件中删除 nativescript-phone,运行 ns clean,运行 tns debug android,但它仍然无法正常工作.
我的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"
}
我的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>
我全局安装的东西:
NativeScript: 8.2.2
NPM: 8.5.2
Node: 17.7.1
Angular: 8.0.6
(如果它仍然相关)我正在开发带有 M1 芯片的设备。
我已经通过升级到最新的 NativeScript 版本 8.2.3 修复了它
现在工作正常。