0

我正在开发的应用程序适用于 ios,但不适用于 android。在将 nativescript 版本从 3.4.1 更新到 3.4.3 并将 Mac OS 更新到 High Sierra 之前,它之前已经工作过。

然后我不得不更新 Android Studio 版本。

以下是 tns debug android 的输出。

Searching for devices...
Preparing project...
Gradle build...
    + applying user-defined configuration from /Mobile/NativeScript-Projects/Genkan/app/App_Resources/Android/app.gradle
    + adding nativescript runtime package dependency: nativescript-optimized
    + adding aar plugin dependency: /Mobile/NativeScript-Projects/Genkan/node_modules/nativescript-imagepicker/platforms/android/nativescript_imagepicker.aar
    + adding aar plugin dependency: /Mobile/NativeScript-Projects/Genkan/node_modules/nativescript-ui-listview/platforms/android/TNSListView-release.aar
    + adding aar plugin dependency: /Mobile/NativeScript-Projects/Genkan/node_modules/nativescript-ui-sidedrawer/platforms/android/TNSSideDrawer-release.aar
    + adding aar plugin dependency: /Mobile/NativeScript-Projects/Genkan/node_modules/nativescript-ui-core/platforms/android/TNSCore-release.aar
    + adding aar plugin dependency: /Mobile/NativeScript-Projects/Genkan/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar

FAILURE: Build failed with an exception.

* Where:
Build file '/Mobile/NativeScript-Projects/Genkan/platforms/android/app/build.gradle' line: 64

* What went wrong:
A problem occurred configuring project ':app'.
> Could not get unknown property 'outputFile' for task ':app:packageDebug' of type com.android.build.gradle.tasks.PackageApplication.

 * 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 0s
Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.

AndroidManifest.xml

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

    <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_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <application
        android:name="com.tns.NativeScriptApplication"
        android:allowBackup="true"
        android:icon="@drawable/icon"
        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"
            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"/>
    </application>
</manifest>
4

2 回答 2

1

这通常是由于 java JDK 版本不兼容而发生的。请使用以下命令检查您当前的 java 版本: java --version

如果已经安装了 java,则首先删除该版本,然后从https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html安装 LTS 版本的 java jdk

于 2020-01-21T10:31:09.537 回答
0

来自文档:https ://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api

但是,涉及访问 outputFile 对象的更复杂的任务不再起作用。这是因为在配置阶段不再创建特定于变体的任务。这会导致插件预先不知道其所有输出,但这也意味着更快的配置时间。

在您的配置中使用outputFileName而不是。outputFileGradle

于 2018-04-16T03:49:45.670 回答