生成签名的APK输出没有文件

时间:2016-05-21 14:43:31

标签: java android android-gradle build.gradle

生成已签名的APK时,不会输出任何文件。 gradle构建日志中没有错误,如下所示,所以我不知道从哪里开始解决这个问题。

以下是显示此现象的视频:https://www.youtube.com/watch?v=AuZvSRXe-b0

这是gradle控制台日志:

   Executing tasks: [:app:assembleRelease]

    Parallel execution with configuration on demand is an incubating feature.
    Incremental java compilation is an incubating feature.
    :app:preBuild UP-TO-DATE
    :app:preReleaseBuild UP-TO-DATE
    :app:checkReleaseManifest
    :app:preDebugBuild UP-TO-DATE
    :app:prepareCnPedantSweetalertLibrary13Library UP-TO-DATE
    :app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
    :app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
    :app:prepareComAndroidSupportCardviewV72340Library UP-TO-DATE
    :app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
    :app:preDebugAndroidTestBuild UP-TO-DATE
    :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
    :app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
    :app:prepareComAndroidSupportSupportV132340Library UP-TO-DATE
    :app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
    :app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
    :app:prepareComGithubChyrtaAndroidOnboarder06Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesAds900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesAdsLite900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesAnalytics900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesBasement900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesGcm900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesIid900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesLocation900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesMaps900Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesTasks900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseAds900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseAnalytics900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseAnalyticsImpl900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseCommon900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseCore900Library UP-TO-DATE
    :app:prepareComGoogleFirebaseFirebaseIid900Library UP-TO-DATE
    :app:prepareComKarumiDexter222Library UP-TO-DATE
    :app:prepareComMikepenzAboutlibraries566Library UP-TO-DATE
    :app:prepareComMikepenzFastadapter151Library UP-TO-DATE
    :app:prepareComMikepenzFontawesomeTypeface4501Library UP-TO-DATE
    :app:prepareComMikepenzGoogleMaterialTypeface2101OriginalLibrary UP-TO-DATE
    :app:prepareComMikepenzIconicsCore2511Library UP-TO-DATE
    :app:prepareComMikepenzMaterialdrawer464Library UP-TO-DATE
    :app:prepareComMikepenzMaterialize051Library UP-TO-DATE
    :app:prepareComOgaclejapanSmarttablayoutLibrary160Library UP-TO-DATE
    :app:prepareComOgaclejapanSmarttablayoutUtilsV4160Library UP-TO-DATE
    :app:prepareComPnikosisMaterialishProgress10Library UP-TO-DATE
    :app:prepareComWdullaerMaterialdatetimepicker230Library UP-TO-DATE
    :app:prepareIoGithubYavskiFabSpeedDial104Library UP-TO-DATE
    :app:prepareNetDanlewAndroidJoda292Library UP-TO-DATE
    :app:prepareReleaseDependencies
    :app:compileReleaseAidl UP-TO-DATE
    :app:compileReleaseRenderscript UP-TO-DATE
    :app:generateReleaseBuildConfig UP-TO-DATE
    :app:mergeReleaseShaders UP-TO-DATE
    :app:compileReleaseShaders UP-TO-DATE
    :app:generateReleaseAssets UP-TO-DATE
    :app:mergeReleaseAssets UP-TO-DATE
    :app:generateReleaseResValues UP-TO-DATE
    :app:generateReleaseResources UP-TO-DATE
    :app:mergeReleaseResources UP-TO-DATE
    :app:processReleaseManifest UP-TO-DATE
    :app:processReleaseResources UP-TO-DATE
    :app:generateReleaseSources UP-TO-DATE
    :app:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
    :app:compileReleaseJavaWithJavac UP-TO-DATE
    :app:compileReleaseNdk UP-TO-DATE
    :app:compileReleaseSources UP-TO-DATE
    :app:lintVitalRelease
    :app:prePackageMarkerForRelease
    :app:processReleaseJavaRes UP-TO-DATE
    :app:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
    :app:transformClassesAndResourcesWithProguardForRelease UP-TO-DATE
    :app:collectReleaseMultiDexComponents UP-TO-DATE
    :app:transformClassesWithMultidexlistForRelease UP-TO-DATE
    :app:transformClassesWithDexForRelease UP-TO-DATE
    :app:mergeReleaseJniLibFolders UP-TO-DATE
    :app:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
    :app:validateExternalOverrideSigning
    :app:packageRelease UP-TO-DATE
    :app:assembleRelease

    BUILD SUCCESSFUL

    Total time: 3.483 secs

4 个答案:

答案 0 :(得分:1)

我使用gradle脚本将release apk组合到目标路径。 这是代码:

android {
   applicationVariants.all{ variant->
      variant.outputs.each { output->
        if(variant.buildType.name.equals('release')){
            output.outputFile = new File('/Users/yourname/Desktop/', ’myapk.apk')
        }
    }
   }
}

答案 1 :(得分:0)

尝试重新启动并使缓存无效:

enter image description here

this answer中所述:

答案 2 :(得分:0)

事实证明,Android Studio 2.2 Preview 1有时会喜欢在错误的目录中输出文件。在尝试生成APK时,文件被放入AndroidStudioProjects / AppName / app / build / outputs / apk,而不是弹出对话框中的所选目录。

答案 3 :(得分:0)

我也是,只需将你的gradle 2.2.0-alpha1改为gradle 1.5.0或其他,可以正常生成签名的apk。