1. HTTP3W博客首页
  2. 技术
  3. android

Android studio打包apk遇到的问题

问题一、Android studio 生成apk文件时的 key store path 的问题

使用Android studio生成apk文件时,Key store path 是密钥库文件地址的意思,新手菜鸟会想,我怎么知道他在哪里,其实他的地址是你来决定的。如下图,你选择一个文件夹后,填写file name,然后点击ok就生成了

Android studio打包apk遇到的问题

用户密码:

app->build.gradle–>signingConfigs {config

问题二、Errors while building APK. You can find the errors in the ‘Messages’ view.解决办法

当你出现这种情况,有两种解决办法:(都是在build.gradle中修改)

android{
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

Android studio打包apk遇到的问题
 aaptOptions.cruncherEnabled = false
 aaptOptions.useNewCruncher = false

问题三:A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkA

报错内容如下:

Error:There were multiple failures while executing work items

Error:Execution failed for task ‘:app:mergeDebugResources’.There were multiple failures while executing work items
A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
Error while processing D:\androidProject\KuaiChuan-master\app\src\main\res\drawable\ic_storage_24dp.xml : Can’t process attribute android:fillColor=”@color/color_storage”: references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
Error while processing D:\androidProject\KuaiChuan-master\app\src\main\res\drawable\ic_device_24dp.xml : Can’t process attribute android:fillColor=”@color/color_device”: references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction

这个bug解决起来也比较简单,在你的app的build.gradle的defaultConfig中添加如下的代码就可以了:

defaultConfig{  
   vectorDrawables.useSupportLibrary = true  
}  

添加完 vectorDrawables.useSupportLibrary = true这行代码之后,gradle一下就可以了。

Android studio打包apk遇到的问题

如果本文对您有所帮助,麻烦点击一下下面的点赞按钮,谢谢

1、原创文章,作者:诺米,如若转载,请注明出处:https://www.http3w.com/archives/532

2、本站内容若有雷同从属巧合,若侵犯了您的权益,请联系本站删除,E-mail: wtao219@qq.com

发表评论

您的电子邮箱地址不会被公开。

联系我们

254007489

在线咨询:点击这里给我发消息

邮件:wtao219@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息