cant build for android

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
202
just updated to api 29 and 30, installed cmake, ndk and a bunch of other things and build fails

release keeps saying waiting for device

and this on debug
TRANS cerberus compiler V2021-03-21
Parsing...
Semanting...
Translating...
Building...
:app:clean
:app:checkDebugClasspath
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl NO-SOURCE
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:processDebugResources
:app:generateDebugSources
:app:javaPreCompileDebug
Note: C:\Users\eric_\Desktop\adventures of AZ styles\azstyles.buildv2021-05-16\android\app\src\main\java\com\cerberus\cerberusgame\CerberusGame.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugJavaWithJavac
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug
:app:transformDexArchiveWithDexMergerForDebug
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:checkDebugLibraries
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:installDebug
09:33:14 V/ddms: execute: running am get-config
09:33:14 V/ddms: Got reply 'FAIL', diag='closed'

09:33:14 E/ddms: ADB rejected shell command (am get-config): closed
09:33:14 V/ddms: execute: returning
:app:installDebug FAILED
29 actionable tasks: 28 executed, 1 up-to-date
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.AdbCommandRejectedException: closed

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
TRANS FAILED: Android build failed.
Done.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
852
Make sure that the developer mode is enabled on the Android device. Install any USB drivers if required on the host system. Keep an eye on the android device as sometimes you can miss the except dialog for the connection to allow the PC to upload the apk etc to the device.
 

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
202
No device plugged in at all, just want to build an APK and install Manually

Do I need a device plugged in?
Built an APK before no problems figured some things needed updating
 
Last edited:

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
Well, judging from the messages, the build process should be fine. It is just the automatic installation that is failing. But I will try myself.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
But I will try myself.
Just tried. When I build without a device connected, I get the same message like you.
But the apk is created:
1623333797297.png
 

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
202
Ok thanks Mike I will check when I get home
Can you explain or point me to some info on the device part of this. Is it phone and what happens exactly?
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
At this point CX gives the ADB tool of Android Studio the command to install it onto a connected device like a phone or a simulator that is already active.
And that part can't be done.
 

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
202
cool seems i just forgot where to find it! But when i build a release ver. it says waiting for device forever, did i possibly install something i shouldnt have or is there a way to bypass that thanks
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
That's just hie it up. Press the button. The app should be there.
 

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Hi, I haven't compiled anything for Android in a while and tried again today with the latest CX github version + Android Studio 4.2 + lastest SDK Build Tools+API 28, 29, 30 installed + licenses copied to my C:\Android\Android Studio directory

When I try to compile, here is what i get :
Building...
Warning: Dependant package with key emulator not found!

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Failed to install the following SDK components: build-tools;30.0.3 Android SDK Build-Tools 30.0.3 Install the missing components using the SDK manager in Android Studio.
Any idea why? Thanks!
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
@MikeHart and me did some testing on this and came up with the following:
Change the java path to yourAndroidStudioFolder\jre to use the inbuilt java sdk of Android Studio
Change the following config values in targets/android/template/config.cxs
Code:
#ANDROID_MIN_SDK_VERSION="18"
#ANDROID_TARGET_SDK_VERSION="30"
#ANDROID_BUILD_TOOLS_VERSION="30.0.3"
#ANDROID_GRADLE_VERSION="4.1.0"
#ANDROID_GRADLE_DISTRIBUTION="gradle-6.5-all.zip"
Delete your build folder to get a fresh build.

BTW These changes are already in the develop branch on GitHub

Edit: I should have read more properly ... you are using the develop version!?
Did you try opening Android Studio with your project? Sometimes it gives you some more hints or solves the problem with the sdk for you.
 
Last edited:

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Thanks a lot Phil (and the team)! I do use the develop version. Well I deleted the build folder, tried to build again using CX which lead to the same messages than before, than I imported the Android build directory into Android Studio.

I got that message from Android Studio when importing :

The project and Android Studio point to different Android SDKs.

Android Studio's default SDK is in:
C:\Users\Pierre\AppData\Local\Android\Sdk

The project's SDK (specified in local.properties) is in:
C:\Android\Android Studio

To keep results consistent between IDE and command line builds, only one path can be used. Do you want to:

[1] Use Android Studio's default SDK (modifies the project's local.properties file.)

[2] Use the project's SDK (modifies Android Studio's default.)

Note that switching SDKs could cause compile errors if the selected SDK doesn't have the necessary Android platforms or build tools.
and then chose Android Studio's SDK, then I built the project inside Android Studio, it all went fine, Android Studio advised me to update Android Gradle Plugin, which I didn't. Then after closing the app I was able to compile it again inside CerberusX.
I don't have a clue what happened , maybe you do, anyway it's working again thanks to you!
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,165
I have rebuild the gradle wrapper jar file and uploaded the new version to the repository. It build before that on my system too, but who knows :)

I have tested it with the latest Android version, but without any admob or iap stuff.
Also I am linking to the JRE now instead of a separate JAVA installation.

My config file entries look like this:

Code:
'--------------------
'Java dev kit path
'
'Must be set to a valid dir for ANDROID and FLASH target support
'
'The Java JDK is currently available here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
'
JDK_PATH="D:\Program Files\Android\Android Studio\jre"
'--------------------

'--------------------
'Android SDK and tool paths.
'
'Must be set to a valid dir for ANDROID target support
'
ANDROID_PATH="C:\Users\mike\AppData\Local\Android\Sdk"
'--------------------

Linking to the SDK path inside your local appdata directory avoids the copying of the licenses folder.

So basically I just installed the latest Android Studio. Then started it. It asked for the SDK directory but I had deleted that before. So I canceled that dialog when it wanted to recreate it and download SDK 30. I let it do that. After it was finished, CX build out of the box with the paths set in its config file in the bin directory.

EDIT: Make sure a licenses folder exists. I just did the procedure again and I needed to install an SDK from within studio to create the licenses folder in C:\Users\mike\AppData\Local\Android\Sdk. Have to see if I can automate this further.
 
Last edited:

Pierrou

Active member
Joined
Jul 6, 2017
Messages
234
Thanks Phil7 and Mike! Incredible how every problem we occasionnaly stumble upon gets a quick and simple solution here thanks to one of you. We will never be able to thank you enough for your dedication!
 

Phil7

Administrator
CX Code Contributor
3rd Party Tool Dev
Joined
Jun 26, 2017
Messages
643
Thank you for these kind words. This community and its atmosphere is really something special. Most of the things I do here just don't feel like work. It's what I do when I don't have any energy left for the tedious stuff I have to do otherwise.
 
Last edited:
Top Bottom