错误:`cordova build android`不生成APK

时间:2017-12-19 14:05:17

标签: android cordova

使用Cordova构建Android平台会打印BUILD SUCCESSFUL,但Built the following apk(s)列表为空,输出目录(platforms/android/build/outputs/)也是如此。

$ ./node_modules/.bin/cordova build android
Preparing Firebase on Android
ANDROID_HOME=F:\harieta\griozdai\sdk-tools-windows-3859397
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_1x9jhvsdv38p50axqouny9ti6.run(E:\ivairus\cygwin\home\Dominykas\darbalaukiai\__kontraktai\iko-app\platforms\android\build.gradle:142)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild 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
: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
:prepareAndroidArchLifecycleRuntime100Library
:prepareComAndroidSupportAnimatedVectorDrawable2701Library
:prepareComAndroidSupportAppcompatV72701Library
:prepareComAndroidSupportCardviewV72701Library
:prepareComAndroidSupportCustomtabs2701Library
:prepareComAndroidSupportSupportCompat2701Library
:prepareComAndroidSupportSupportCoreUi2701Library
:prepareComAndroidSupportSupportCoreUtils2701Library
:prepareComAndroidSupportSupportFragment2701Library
:prepareComAndroidSupportSupportMediaCompat2701Library
:prepareComAndroidSupportSupportV42701Library
:prepareComAndroidSupportSupportVectorDrawable2701Library
:prepareComFacebookAndroidFacebookAndroidSdk4290Library
:prepareComFacebookAndroidFacebookApplinks4290Library
:prepareComFacebookAndroidFacebookCommon4290Library
:prepareComFacebookAndroidFacebookCore4290Library
:prepareComFacebookAndroidFacebookLogin4290Library
:prepareComFacebookAndroidFacebookMessenger4290Library
:prepareComFacebookAndroidFacebookPlaces4290Library
:prepareComFacebookAndroidFacebookShare4290Library
:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1180Library
:prepareComGoogleAndroidGmsPlayServicesAnalyticsImplLicense1180Library
:prepareComGoogleAndroidGmsPlayServicesBase1180Library
:prepareComGoogleAndroidGmsPlayServicesBaseLicense1180Library
:prepareComGoogleAndroidGmsPlayServicesBasement1180Library
:prepareComGoogleAndroidGmsPlayServicesBasementLicense1180Library
:prepareComGoogleAndroidGmsPlayServicesTagmanager1180Library
:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi1180Library
:prepareComGoogleAndroidGmsPlayServicesTagmanagerApiLicense1180Library
:prepareComGoogleAndroidGmsPlayServicesTagmanagerLicense1180Library
:prepareComGoogleAndroidGmsPlayServicesTasks1180Library
:prepareComGoogleAndroidGmsPlayServicesTasksLicense1180Library
:prepareComGoogleFirebaseFirebaseAnalytics1180Library
:prepareComGoogleFirebaseFirebaseAnalyticsImpl1180Library
:prepareComGoogleFirebaseFirebaseAnalyticsImplLicense1180Library
:prepareComGoogleFirebaseFirebaseAnalyticsLicense1180Library
:prepareComGoogleFirebaseFirebaseAuth1180Library
:prepareComGoogleFirebaseFirebaseAuthLicense1180Library
:prepareComGoogleFirebaseFirebaseCommon1180Library
:prepareComGoogleFirebaseFirebaseCommonLicense1180Library
:prepareComGoogleFirebaseFirebaseConfig1180Library
:prepareComGoogleFirebaseFirebaseConfigLicense1180Library
:prepareComGoogleFirebaseFirebaseCore1180Library
:prepareComGoogleFirebaseFirebaseCrash1180Library
:prepareComGoogleFirebaseFirebaseCrashLicense1180Library
:prepareComGoogleFirebaseFirebaseIid1180Library
:prepareComGoogleFirebaseFirebaseIidLicense1180Library
:prepareComGoogleFirebaseFirebaseMessaging1180Library
:prepareComGoogleFirebaseFirebaseMessagingLicense1180Library
:prepareMeLeolinShortcutBadger114Library
:prepareOrgApacheCordovaCordovaLib630DebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard
:compileDebugJavaWithJavac
: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.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets
:transformClassesWithDexForDebug
:mergeDebugJniLibFolders
:transformNative_libsWithMergeJniLibsForDebug
:processDebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
:validateSigningDebug
:packageDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 1 mins 48.386 secs
Built the following apk(s):

版本:

$ gradle -v

------------------------------------------------------------
Gradle 4.4
------------------------------------------------------------

Build time:   2017-12-06 09:05:06 UTC
Revision:     cf7821a6f79f8e2a598df21780e3ff7ce8db2b82

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_112 (Oracle Corporation 25.112-b15)
OS:           Windows 10 10.0 amd64

$ ./node_modules/.bin/cordova -v
7.1.0

$ node -v
v8.5.0

$ npm -v
5.4.2

编辑config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="[]" version="1.1.9" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>[]</name>
    <description>
        []
    </description>
    <author email="[]" href="[]">
        []
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <platform name="android">
        <preference name="android-minSdkVersion" value="21" />
        <allow-intent href="market:*" />
        <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" />
        <preference name="loadUrlTimeoutValue" value="120000" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <preference name="deployment-target" value="9.3" />
        <preference name="UIWebViewBounce" value="false" />
        <preference name="DisallowOverscroll" value="true" />
        <preference name="BackupWebStorage" value="none" />
        <preference name="target-device" value="handset" />
        <preference name="StatusBarStyle" value="lightcontent" />
        <feature name="StatusBar">
            <param name="ios-package" onload="true" value="CDVStatusBar" />
        </feature>
        <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="20" src="resources/ios/icon/icon-20@1x.png" width="20" />
        <icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
        <icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
        <icon height="29" src="resources/ios/icon/icon-29@1x.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
        <icon height="40" src="resources/ios/icon/icon-40@1x.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50@1x.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@1x.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@1x.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@1x.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="228" src="resources/ios/icon/icon-76@3x.png" width="228" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small@1x.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" />
        <icon height="57" src="resources/ios/icon/icon-57@1x.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon-57@2x.png" width="114" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <icon height="512" src="resources/ios/icon/iTunesArtwork@1x.png" width="512" />
        <icon height="1536" src="resources/ios/icon/iTunesArtwork@3x.png" width="1536" />
        <splash height="1242" src="resources/ios/splash/Default-1242@3x~iphone6s-landscape_2208x1242.png" width="2208" />
        <splash height="2208" src="resources/ios/splash/Default-1242@3x~iphone6s-portrait_1242x2208.png" width="1242" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone_640x1136.png" width="640" />
        <splash height="750" src="resources/ios/splash/Default-750@2x~iphone6-landscape_1334x750.png" width="1334" />
        <splash height="1334" src="resources/ios/splash/Default-750@2x~iphone6-portrait_750x1334.png" width="750" />
        <splash height="1496" src="resources/ios/splash/Default-Landscape@2x~ipad_2048x1496.png" width="2048" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad_2048x1536.png" width="2048" />
        <splash height="748" src="resources/ios/splash/Default-Landscape~ipad_1024x748.png" width="1024" />
        <splash height="2008" src="resources/ios/splash/Default-Portrait@2x~ipad_1536x2008.png" width="1536" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad_768x1024.png" width="768" />
        <splash height="1004" src="resources/ios/splash/Default.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone_640x960.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    </platform>
    <engine name="ios" spec="^4.5.4" />
    <engine name="android" spec="^6.3.0" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-screen-orientation" spec="^2.0.2" />
    <plugin name="cordova-plugin-facebook4" spec="^1.9.1">
        <variable name="APP_ID" value="[]" />
        <variable name="APP_NAME" value="[]" />
    </plugin>
    <plugin name="cordova-plugin-device" spec="^1.1.7" />
    <plugin name="cordova-plugin-statusbar" spec="^2.3.0" />
    <plugin name="cordova-plugin-firebase" spec="~0.1.25" />
</widget>

1 个答案:

答案 0 :(得分:0)

Joe Bowser回复了issue thread on jira。这是一个已知的错误,在cordova-android 7.0.0和master和6.4.x中修复。