@nativescript/imagepicker在Android上不工作(无法构建插件)
我正在尝试构建一个Nativescript应用程序来运行我的Android设备。我一直在尝试构建和运行,但不幸的是,我不断遇到以下构建错误:@nativescript/imagepicker在Android上不工作(无法构建插件),android,nativescript,nativescript-angular,nativescript-plugin,Android,Nativescript,Nativescript Angular,Nativescript Plugin,我正在尝试构建一个Nativescript应用程序来运行我的Android设备。我一直在尝试构建和运行,但不幸的是,我不断遇到以下构建错误: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':verifyReleaseResources'. > A failure occurred while executing com.android.build.gradle.i
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/.../platforms/tempPlugin/imagepicker/src/main/AndroidManifest.xml:4:3-61: AAPT: error: attribute android:requestLegacyExternalStorage not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Failed to build plugin @nativescript/imagepicker :
Error: Command ./gradlew failed with exit code 1
我尝试过两种解决方案,一种贴在这里
然后,我尝试了以下步骤:。然而,我没有成功。如果适用的话,我也无法弄清楚如何使用nativescript权限
下面是我的AndroidManifest和package.json文件
AndroidManifest.xml
<?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-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.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true">
<meta-data android:name="io.sentry.dsn" ... />
<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">
<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>
还有一个补丁修复了
@nativescript/core
上的android:requestLegacyExternalStorage
,它需要与imagepicker
更新一起使用
您需要将这些依赖项更新为以下内容:
"@nativescript/core": "~8.0.0",
"@nativescript/imagepicker": "~1.0.4"
谢谢,我正在研究其他人也推荐的修复方法。我还没有完全让它工作,但我知道这些更新是必要的。我认为我也需要完全迁移到NS8,但仍然需要让它工作。
"@nativescript/core": "~8.0.0",
"@nativescript/imagepicker": "~1.0.4"