我使用较旧的 android studio 版本来构建我的应用程序,现在我有了最后一个版本。当我想要制作签名的 apk 时,我会给出错误,因为我想使用 proguard 并且 proguard-rules.pro 不存在。我手动构建了它在应用程序文件夹中,但我仍然遇到错误。当我将 'proguard-rules.pro'
删除到 build.gradle 中时,问题正在解决,但我想将 proguard 与规则一起使用,因为当 minifyEnabled
为 true
并且从此代码中删除 'proguard-rules.pro'
时,求和类和求和文件不起作用 proguardFiles getDefaultProguardFile ('proguard-android.txt'), 'proguard-rules.pro'
到 build.gradle 中。
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. > java.io.FileNotFoundException: C:\Users\Hossein\Desktop\Root\app\proguard-rules.pro (The system cannot find the file specified) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED
最佳答案
将名为 proguard-rules.pro
的文件添加到项目的 Root\app\
中,并再次对您的应用进行签名。
关于java - Android Studio 生成签名的 apk 无法正常工作2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40849311/