Unable to build app for testing: apk preparation failed

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

brotee
Posts: 31
Joined: Sat Mar 12, 2016 9:15 am

Unable to build app for testing: apk preparation failed

Post by brotee » Mon Jul 16, 2018 9:29 pm

Any solutions for this? i have deleted .android, i dont have accents in file names, its the same if i try with an empty stack too..

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Mon Jul 16, 2018 9:48 pm

Hi brotee,

Which version of LC are you using, and in which platform?

Moreover what is the version of your Android SDK Tools, SDK Build Tools, and SDK Platform Tools?

Best,
Panos
--

brotee
Posts: 31
Joined: Sat Mar 12, 2016 9:15 am

Re: Unable to build app for testing: apk preparation failed

Post by brotee » Mon Jul 16, 2018 9:54 pm

i have tried LC 9.01 9.0 8.1.9

windows 7

SDK platforms installed: 2.2, 4.03, 4.4, 5.1, 8.0
SDK build tools i have tried 22.0.1, 26.00, 28.01
SDK platform tools: 28.0.0
SDK tools: 26.1.1

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Mon Jul 16, 2018 10:12 pm

Hmm strange. I am not sure why you get that error. Can you please try the following in LC 9.0.1 RC-1:

1. Open the msg box
2. Type

Code: Select all

put true into gRevDevelopment
3. Type

Code: Select all

edit the script of stack revSaveAsAndroidStandalone at 912
The script editor should open now, showing the script of the stack you requested.

4. Find line

Code: Select all

buildAPK tUnalignedApkFile, tUnsignedParam, tAssetArchive, tClassesFile, tLibsBuildFolder
(should be line no 912)

5. Add a breakpoint to this line.
6. Find line

Code: Select all

throw "apk preparation failed"
(should be 917) and change it to:

Code: Select all

throw "apk preparation failed" &  the result
7. Click the "Apply" button (top left)
8. Try to save again as an android standalone

9. The execution should now stop at the breakpoint you added
10. Click on the "Step over" button, until the updated line is executed.

What is the new error message? Hopefully it should be more informative.


Best regards,
Panos

brotee
Posts: 31
Joined: Sat Mar 12, 2016 9:15 am

Re: Unable to build app for testing: apk preparation failed

Post by brotee » Mon Jul 16, 2018 10:18 pm

yes it is :)

it would be great if error messages would be informative

message was:

"failederror opening registry key
'Software\JavaSoft\Java Runtime Environment'

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Mon Jul 16, 2018 10:28 pm

Thanks, this is helpful. Which version of Java have you installed? Note that Java 9 and 10 will not work, you need Java 8.

brotee
Posts: 31
Joined: Sat Mar 12, 2016 9:15 am

Re: Unable to build app for testing: apk preparation failed

Post by brotee » Mon Jul 16, 2018 10:32 pm

Yep, i have read the posts before about this topic and i had 8.171

i have uninstalled every java, and deleted the whole directory.. and reinstalled 8.171 only and now it works

ty for your helping :)

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Mon Jul 16, 2018 10:44 pm

You are welcome ;)

synto
Posts: 40
Joined: Thu Jul 18, 2019 9:31 am
Location: Paris, Fr

Re: Unable to build app for testing: apk preparation failed

Post by synto » Thu Aug 01, 2019 10:57 am

I have used LC Community 9,5 with no problem, but with the LCIndy 9,5 trial, i'm unable to save a standalone.
Error "apk preparation failed". More info with APK compilation code modified is "THIS TOOL IS DEPRECATED. See --help for more informations"

But same LC project under LCCommunity 9,5 is running without problems

Any idea ?

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Thu Aug 01, 2019 11:14 am

Hello synto,

Are you on Mac, Linux or Windows?

Also, are you trying to build the exact same stack in Indy vs Community?

In your android-sdk folder, what is the version of the following:

- SDK platforms
- SDK build tools
- SDK platform tools
- SDK tools

Kind regards,
Panos
--

synto
Posts: 40
Joined: Thu Jul 18, 2019 9:31 am
Location: Paris, Fr

Re: Unable to build app for testing: apk preparation failed

Post by synto » Thu Aug 01, 2019 11:29 am

Hi Panos,
I'm on Ubuntu and yes, i'm loading the same LC project
The only difference is that Indy9,5,0 requesting API28 in Android SDK directory

Here is all the version numbers:
- SDK platforms API 28
- SDK build tools 29,0,1
- SDK platform tools 29,0,1
- SDK tools 26,1,1

Thanks for your help

Fred

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Thu Aug 01, 2019 12:21 pm

Hello Fred,

>>>>>The only difference is that Indy9,5,0 requesting API28 in Android SDK directory
Do you get that request only on Indy? This is a requirement for all editions, including community.

Anyway, the setup I have in my Ubuntu box that works with LC 9.5 Indy is:

- SDK platforms API 15,19,23,28
- SDK build tools 19.1
- SDK platform tools 20
- SDK tools 24.4.1

It might be worth giving a try with these ^^^^ versions installed. If you try this, make sure you uninstall the newer versions first.

Kind regards,
Panos
--

synto
Posts: 40
Joined: Thu Jul 18, 2019 9:31 am
Location: Paris, Fr

Re: Unable to build app for testing: apk preparation failed

Post by synto » Thu Aug 01, 2019 12:28 pm

>>>>>The only difference is that Indy9,5,0 requesting API28 in Android SDK directory
Do you get that request only on Indy? This is a requirement for all editions, including community.

Yes only on Indy, but i have developed the stack on Communty 9,5,0dp

Ok i will try to install Indy on clear platform.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Unable to build app for testing: apk preparation failed

Post by LiveCode_Panos » Thu Aug 01, 2019 12:38 pm

Hello Fred,
Yes only on Indy, but i have developed the stack on Communty 9,5,0dp
Aha! This explains why only 9.5.0 Indy asks you for API 28. LC 9.5.0 DP-1 does not ask for API 28, but 9.5.0 (STABLE) does.

Do I suggest you install these versions of the following tools:

- SDK platforms API 15,19,23,28
- SDK build tools 19.1
- SDK platform tools 20
- SDK tools 24.4.1

and uninstall the existing versions you have:
- SDK build tools 29,0,1
- SDK platform tools 29,0,1
- SDK tools 26,1,1
It might be the case that one of the newer versions of the tools you have installed does not work quite well with API 28 and/or LiveCode

synto
Posts: 40
Joined: Thu Jul 18, 2019 9:31 am
Location: Paris, Fr

Re: Unable to build app for testing: apk preparation failed

Post by synto » Thu Aug 01, 2019 2:16 pm

I've downgraded everything but Platforms-tools cause i wasn't be able to found it on web, it seems to be a very older version.

Unfortunately, i've got the same "DEPRECATED TOOL" error... :cry:

Post Reply

Return to “Android Deployment”