在 android rom 中编译应用程序时出错。 (APK为空)
Error while Compiling an app in android rom. (APK empty)
尝试使用 mm 构建 apk 时出现以下错误。
Reading program jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/APPS/HelloWorld_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar]
Error: The output jar is empty. Did you specify the proper '-keep' options?
make: *** [out/target/common/obj/APPS/HelloWorld_intermediates/proguard.classes.jar] Error 1
#### make failed to build some targets (20 seconds) ####
这些是我的 make 文件的内容 Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := HelloWorld
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
这是我的 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.helloworld" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".HelloWorld"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_HELLOWORLD" />
</intent-filter>
</activity>
</application>
</manifest>
上面的应用程序在 android 工作室中编译得很好。要在我用来编译 Rom 的相同环境中编译它,我必须删除预构建的 R 文件。有什么建议可以帮助编译这个应用程序吗?
我遇到了同样的问题。将 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
添加到您的 Android.mk
并创建标志文件。
-keep class com.yourpackage.* {
*;
}
好吧,我错了,问题不在于progard.flags文件,我试图编译一个用Gradle编写的应用程序,因为andriod ROM编译环境支持ANT。
尝试使用 mm 构建 apk 时出现以下错误。
Reading program jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/APPS/HelloWorld_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar]
Reading library jar [/Volumes/untitled/WORKING_DIRECTORY/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar]
Error: The output jar is empty. Did you specify the proper '-keep' options?
make: *** [out/target/common/obj/APPS/HelloWorld_intermediates/proguard.classes.jar] Error 1
#### make failed to build some targets (20 seconds) ####
这些是我的 make 文件的内容 Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := HelloWorld
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
这是我的 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.helloworld" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".HelloWorld"
android:label="@string/app_name"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.APP_HELLOWORLD" />
</intent-filter>
</activity>
</application>
</manifest>
上面的应用程序在 android 工作室中编译得很好。要在我用来编译 Rom 的相同环境中编译它,我必须删除预构建的 R 文件。有什么建议可以帮助编译这个应用程序吗?
我遇到了同样的问题。将 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
添加到您的 Android.mk
并创建标志文件。
-keep class com.yourpackage.* {
*;
}
好吧,我错了,问题不在于progard.flags文件,我试图编译一个用Gradle编写的应用程序,因为andriod ROM编译环境支持ANT。