Encountered an error when releasing the Android installation package for the first time

Hey, everyone “openfl” developers, I encountered an error when trying to publish “apk” using “lime build android” for the first time. Can I request support?

<?xml version="1.0" encoding="utf-8"?>
<config>
	
	<section id="defines">
		
		<set name="SDK_ROOT" value="HOME/SDKs/" />
		<set name="ANDROID_NDK_DIR" value="HOME/SDKs/" />
		<set name="ANDROID_SDK" value="C:\Users\Administrator\AppData\Local\Android\Sdk" />
		<set name="ANT_HOME" value="HOME/SDKs//ant" />
		<set name="JAVA_HOME" value="C:\Program Files\Eclipse Adoptium\jdk-25.0.4.7-hotspot" />
		
	</section>
	<define name="AIR_SDK" value="D:\AIRSDK\AIRSDK_51.3.3.2" />
	<define name="ANDROID_NDK_ROOT" value="C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\30.0.16138531" />
	<define name="ANDROID_SETUP" value="true" />
	
</config>

PS C:\Users\Administrator\Desktop\SimpleBox2D> lime build android -debug
Creating C:/Users/Administrator/Desktop/SimpleBox2D/Export/android/obj/obj/android-debug-v7/__pch/haxe/hxcpp.h.gch…
‘clang++’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Error: Could not create PCH

Which version of hxcpp do you have? You should use the git version:
```
haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp
```

Thank you for your answer. Is there a problem with using ‘haxelib hxcpp’?

By the way, why did you recommend me to use “git hxcpp”?

There are android ndk issues with hxcpp 4.3.2 that are only solved in git hxcpp:

They can cause similar errors to the ones you were experiencing.

Okay, thank you for your answer. The “Java JDK” I used was “17.0”, the “Android NDK” was “21.4”, and then I used “Git hxcpp”

<set name="ANDROID_SDK" value="C:\Users\Administrator\AppData\Local\Android\Sdk" />

<define name="ANDROID_NDK_ROOT" value="C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\21.4.7075529" />

<set name="JAVA_HOME" value="C:\Program Files\Eclipse Adoptium\jdk-17.0.20.101-hotspot" />

I have successfully published the ‘. apk’ file, but I have encountered an issue where I am using ‘- release’ to publish, but the file contains the word ‘debug’

SimpleBox2D-debug.apk ?

I now know that the certificate needs to be referenced in the project configuration file in order to correctly publish the ‘apk’

<?xml version="1.0" encoding="utf-8"?>
<project>

	<meta title="Simple Box2D" package="org.openfl.samples.simplebox2d" version="1.0.0"
		company="OpenFL" />
	<app file="SimpleBox2D" main="Main" path="Export" />

	<source path="Source" />

	<haxelib name="openfl" />
	<haxelib name="box2d" />

	<assets path="Assets" rename="assets" />

	<certificate path="my-release-key.jks" password="785597448" alias="my-alias" />

</project>

Microsoft Windows [版本 10.0.19045.7417]
(c) Microsoft Corporation。保留所有权利。

C:\Users\Administrator>haxelib list
actuate: [1.9.0]
box2d: [1.2.4]
hxcpp-debug-server: [dev:c:\Users\Administrator.vscode\extensions\vshaxe.hxcpp-debugger-1.2.4\hxcpp-debug-server]
hxcpp: 4.3.2 [git]
layout: [1.2.1]
lime-samples: [7.0.0]
lime: [8.3.2]
nape-haxe4: [2.0.22]
openfl-samples: [8.7.0]
openfl: [9.5.2]
starling: [2.8.0]
swf: [3.4.0]

C:\Users\Administrator>

1 Like