我一直在尝试使用Cordova和Ionic构建一个Android应用程序,但构建仍然失败。我在多个发行版上多次尝试过,包括Windows 7。
我在两个环境中都正确设置了PATH,JAVA_HOME和ANDROID_HOME路径,但我真的没有其他想法可以看。
这是上次运行的报告,它不断发出此错误:
$ cordova build android
Running command: "C:\Program Files\nodejs\node.exe" "C:\Users\utente\Desktop\APPLICATION\differenziapp windows\app-smartphone\hooks\after_prepare\010_add_platform_class.js" "C:/Users/utente/Desktop/APPLICATION/differenziapp windows/app-smartphone"
add to body class: platform-android
ANDROID_HOME=C:\Users\utente\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
null
org.xwalk:xwalk_core_library_beta:18+
Observed package id 'add-ons;addon-google_apis-google-24' in inconsistent location 'C:\Users\utente\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-24-1' (Expected 'C:\Users\utente\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-24')
Already observed package id 'add-ons;addon-google_apis-google-24' in 'C:\Users\utente\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-24'. Skipping duplicate at 'C:\Users\utente\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-24-1'
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preArmv7DebugBuild UP-TO-DATE
:checkArmv7DebugManifest
:preX86DebugBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:preArmv7ReleaseBuild UP-TO-DATE
:preX86ReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders
:CordovaLib:compileReleaseShaders
:CordovaLib:generateReleaseAssets
:CordovaLib:mergeReleaseAssets
:CordovaLib:mergeReleaseProguardFiles
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:processReleaseManifest
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:incrementalReleaseJavaCompilationSafeguard
:CordovaLib:compileReleaseJavaWithJavac
:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareComAndroidSupportAnimatedVectorDrawable2510Library
:prepareComAndroidSupportAppcompatV72510Library
:prepareComAndroidSupportSupportCompat2510Library
:prepareComAndroidSupportSupportCoreUi2510Library
:prepareComAndroidSupportSupportCoreUtils2510Library
:prepareComAndroidSupportSupportFragment2510Library
:prepareComAndroidSupportSupportMediaCompat2510Library
:prepareComAndroidSupportSupportV42510Library
:prepareComAndroidSupportSupportVectorDrawable2510Library
:prepareOrgXwalkXwalk_core_library_beta184847713Library
:prepareArmv7DebugDependencies
:compileArmv7DebugAidl
:compileArmv7DebugRenderscript
:generateArmv7DebugBuildConfig
:mergeArmv7DebugShaders
:compileArmv7DebugShaders
:generateArmv7DebugAssets
:mergeArmv7DebugAssets
:createXwalkCommandLineFileArmv7Debug
:generateArmv7DebugResValues
:generateArmv7DebugResources
:mergeArmv7DebugResources
:processArmv7DebugManifest
:processArmv7DebugResources
:generateArmv7DebugSources
:incrementalArmv7DebugJavaCompilationSafeguard
:compileArmv7DebugJavaWithJavac
:compileArmv7DebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\utente\Desktop\APPLICATION\differenziapp windows\app-smartphone\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:55: error: XWalkWebViewEngine is not abstract and does not override abstract method evaluateJavascript(String,ValueCallback<String>) in CordovaWebViewEngine
public class XWalkWebViewEngine implements CordovaWebViewEngine {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileArmv7DebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileArmv7DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 18.87 secs
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\utente\Desktop\APPLICATION\differenziapp windows\app-smartphone\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:55: error: XWalkWebViewEngine is not abstract and does not override abstract method evaluateJavascript(String,ValueCallback<String>) in CordovaWebViewEngine
public class XWalkWebViewEngine implements CordovaWebViewEngine {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileArmv7DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
似乎Crosswalk-Webview可能是这里的问题,但我不知道如何解决它。这是我目前的插件列表:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.user.myApp" version="1.0.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>My app</name>
<description>
</description>
<author email="an-email@gmail.com" href="http://www.a-website.com">
Mnemos
</author>
<content src="index.html" />
<allow-navigation href="https://www.google.com/*" />
<allow-navigation href="https://docs.google.com/*" />
<access launch-external="yes" origin="geo:*" />
<allow-intent href="geo:*" />
<allow-intent href="maps:*" />
<access launch-external="yes" origin="maps:*" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
<access launch-external="yes" origin="mailto:*" />
<preference name="Orientation" value="portrait" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="2000" />
<preference name="xwalkVersion" value="xwalk_core_library_beta:18+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<preference name="xwalkMultipleApk" value="true" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.GeoBroker" />
</feature>
<platform name="ios">
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
</platform>
<platform name="android">
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<plugin name="cordova.plugins.diagnostic" spec="~3.3.0" />
<plugin name="cordova-plugin-camera" spec="~2.3.1" />
<plugin name="cordova-plugin-compat" spec="~1.1.0" />
<plugin name="cordova-plugin-console" spec="~1.0.5" />
<plugin name="cordova-plugin-crosswalk-webview" spec="~1.7.0" />
<plugin name="cordova-plugin-device" spec="~1.1.4" />
<plugin name="cordova-plugin-email-composer" spec="~0.8.3" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.1" />
<plugin name="cordova-plugin-keyboard" spec="~1.1.4" />
<plugin name="cordova-plugin-statusbar" spec="~2.2.1" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.6.1" />
<plugin name="cordova-plugin-file" spec="~4.3.1" />
<plugin name="cordova-plugin-file-transfer" spec="~1.6.1" />
</widget>
我安装了多个Android Studio API,所有工具和所有buildtools。我还为所有发行版和开发环境的PATH变量添加了工具和构建工具。
先谢谢大家!
答案 0 :(得分:0)
在您的config.xml
文件中, Android最低SDK版本 16 。
<preference name="android-minSdkVersion" value="16" />
您可能需要安装版本为&gt; = 16的Android SDK。您可以使用Android SDK Manager执行此操作:the checked ones is the possible SDK。
答案 1 :(得分:0)
我设法通过在节点版本管理器的帮助下将nodejs版本更改为之前版本来使其工作,同时,我降级了cordova和ionic。我为android-support-v4-jar安装了一个cordova插件,并安装了一些Android Studio API。我不得不更改build.grade文件并删除其中一个compiledebuggers for android-support。所有这一切都使它成功。让我们希望它继续在其他系统/发行版上工作。
谢谢大家!