构建NativeScript-Android时,任务':compileF1F2F3F4DebugJavaWithJavac'的执行失败

时间:2018-09-13 07:59:07

标签: android nativescript

我正在尝试重新设置NativeScript-App。可悲的是,当我执行tns build android时,我一直遇到错误,无法找出解决问题的方法。

错误:

Running full build
finished with reading lines with js files 
%project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity .java:13: error: cannot access ActivityCompatApi23 public class ErrorReportActivity extends AppCompatActivity {
           ^   class file for android.support.v4.app.ActivityCompatApi23 not found %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:15: error: cannot find symbol
            setTheme(android.support.v7.appcompat.R.style.Theme_AppCompat_NoActionBar);
            ^   symbol:   method setTheme(int)   location: class ErrorReportActivity %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:17: error: cannot find symbol
            super.onCreate(savedInstanceState);
            ^   symbol:   variable super   location: class ErrorReportActivity %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:19: error: cannot find symbol
            new ErrorReport(this).buildUI();
                            ^   symbol:   variable this   location: class ErrorReportActivity %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:22: error: method does not override or implement a method from a supertype
        @Override
        ^ %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:24: error: cannot find symbol
            super.onUserLeaveHint();
            ^   symbol:   variable super   location: class ErrorReportActivity %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:27: error: cannot find symbol
                ErrorReport.killProcess(this);
                                        ^   symbol:   variable this   location: class ErrorReportActivity %project_root%\platforms\android\src\debug\java\com\tns\ErrorReportActivity.java:40: error: cannot find symbol
                Toast.makeText(this, "Couldn't resolve permissions", Toast.LENGTH_LONG).show();
                               ^   symbol:   variable this   location: class ErrorReportActivity Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 8 errors

    FAILURE: Build failed with an exception.

    * What went wrong: Execution failed for task ':compileF1F2F3F4DebugJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.

上次出现此错误时,我不得不重建9补丁,因为它们的格式不正确。这次不是这种情况。我也尝试了另一个版本的Android。我在this case中看到了类似的错误,但是该解决方案并没有帮助我。另外,我非常确定我的配置在上次尝试时(去年)完全可行。我的应用的iOS版本正在运行,没有任何问题。

我的清单看起来像这样:

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

    <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_CALENDAR"/>
    <uses-permission android:name="android.permission.WRITE_CALENDAR"/>
    <!--<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"/>

    <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:screenOrientation="portrait"
                android:configChanges="keyboardHidden|orientation|screenSize"
                android:theme="@style/LaunchScreenTheme"
                android:windowSoftInputMode="stateHidden|adjustResize"
        >

            <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>

app.gradle

android {  
  defaultConfig {  
    generatedDensities = []
    applicationId = %myAppID%
  }  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
  dependencies {
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                details.useVersion '26.0.+'
            }
        }
    }
  }
}

这是我的package.json

{
  //...
    "tns-ios": {
      "version": "3.1.0"
    },
    "tns-android": {
      "version": "3.1.0"
    }
  },
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/platform-server": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",
    "nativescript-angular": "0.3.1-2016-08-04-787",
    "nativescript-calendar": "1.1.2",
    "nativescript-drop-down": "1.3.2",
    "nativescript-fresco": "1.0.6",
    "nativescript-ng2-translate": "1.1.1",
    "nativescript-social-share": "1.3.0",
    "nativescript-telerik-ui": "1.3.1",
    "ng2-translate": "2.2.2",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "tns-core-modules": "^2.4.4",
    "typescript": "^1.8.10",
    "url": "0.10.3",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "babel-traverse": "6.10.4",
    "babel-types": "6.10.2",
    "babylon": "6.8.1",
    "filewalker": "0.1.3",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "0.3.2",
    "nativescript-dev-webpack": "0.0.20",
    "typescript": "1.8.10"
  }
}

0 个答案:

没有答案