无法在设备上应用更改:emulator-5554。错误是:命令./gradlew失败,退出代码为1

时间:2018-04-16 03:43:29

标签: android nativescript-angular

该应用程序我正在ios工作,但不适用于Android。 它之前已经工作过,之前将版本标准版本从3.4.1和Mac OS更新为3.4.3,再到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>

2 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:0)

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

  

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

outputFileName配置中使用outputFile代替Gradle