Common Android Deployment issues

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

scott_morrow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 29
Joined: Tue Jun 27, 2006 8:35 pm
Location: Bellingham, WA USA
Contact:

Re: Common Android Deployment issues

Post by scott_morrow » Wed Dec 29, 2021 3:51 am

I have had the same issue for a while now, with the "JDK Path:" being empty. If I remember correctly, it happened when I updated to the Arctic Fox version of Android Studio. I have been able to build and install on a test device and run the simulator but I don't think I have tried submitting to the Google Play Store since this occurred. I'm interested in what's up with this, too.
Elementary Software
...now with 20% less chalk dust!

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Sat Apr 09, 2022 6:18 pm

I find it "interesting" that LiveCode goes out of its way to make selecting the Android sdk location hard.
Note that there are helpful error messages that have all been commented out in favor of just returning a boolean.
I hacked up my LC 10.3 IDE code in the following way:

In revDeployLibraryAndroid:

Code: Select all

function deployIsValidSDK pPath 
   if there is no folder (pPath & slash & "platforms") or \
         there is no folder (pPath & slash & "platform-tools") or \
         there is no folder (pPath & slash & "tools") then
      return "could not find platforms, platform-tools or tools folders at that path."
      --return false
   end if
   
   if there is no folder pathToRootPlatform(pPath) then
      return "could not find install of required target SDK, make sure it has been installed with the Android SDK Manager"
      --return false
   end if
   
   if there is no file pathToRootClasses(pPath) then
      return "missing root classes, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   if there is no file pathToAapt(pPath) then
      return "missing aapt tool, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   if there is no file pathToAdb(pPath) then
      return "missing adb tool, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   if there is no file pathToSDKClasses(pPath) then
      return "missing sdklib.jar, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   if there is no file pathToZipAlign(pPath) then
      return "missing zipalign tool, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   if there is no file pathToD8(pPath) then
      return "missing d8 tool, make sure your SDK install has not become corrupted"
      --return false
   end if
   
   return empty
end deployIsValidSDK
and in button "Choose Android" of stack "revPreferencesGUI" to accomodate the error messages:

Code: Select all

on mouseUp
   local tPath, tIsValid
   
   answer folder "Please choose the location of your Android development SDK"
   if it is not empty then
      put it into tPath
      put revIDEDeployAndroidIsValidSDK(tPath) into tIsValid
      if tIsValid is empty then
         setAndroidSDK tPath
      else
         answer tIsValid
         --answer error "The chosen folder is not a valid Android SDK. Please ensure you have installed it correctly, and enabled support for" && revIDEDeployAndroidRequiredSDK()
      end if
   end if
end mouseUp

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Common Android Deployment issues

Post by jacque » Wed Jun 29, 2022 11:26 pm

Now I'm getting the same error about an invalud SDK. I do have Android 11 (30) installed and LC sees the JDK. When I run revIDEDeployAndroidRequiredSDK() it returns 11(30). I have Android-30 installed in the platforms folder (and somehow Android-31 as well, not sure if that matters.) My tools folder is old, 26.1.1 with no update listed as available. Platform Tools is 31.0.3 with an available update to 33.0.2. Everything was installed via Android Studio.

I can test to a cabled Android phone fine, but I can't build a standalone. So now what?

Running Mac OS Monterey, LC 9.6.7. Back on Big Sur I don't think I had this problem.

Edit: Build-tools 33 is available but not installed. Should I?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Wed Jun 29, 2022 11:32 pm

I see 11 (API 30) in response to that function.
Have you hacked up those two handlers to see where the error is taking place? Returning "false" from deployIsValidSDK() isn't very useful.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Common Android Deployment issues

Post by jacque » Thu Jun 30, 2022 8:24 pm

I was working from memory, I do see 11 (API 30).

I changed the scripts as you suggested, restarted LC, and got an error that I needed to select my SDK. The change apparently wiped out my previous setting. I made the selection, got no errors, but now it doesn't see my JDK. I'm betting that means I can't even shoot an app to my phone.

Of course, they don't give us a way to select the location of the JDK.

Edit: every time I close Prefs, it wipes out my SDK field. I need to revert back to the original.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Thu Jun 30, 2022 8:28 pm

You *do* have sdk 8 installed as well, right?
It takes a bit more IDE hacking to get just 11 working by itself.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Common Android Deployment issues

Post by jacque » Thu Jun 30, 2022 8:54 pm

So, I have no idea what's going on. I deleted my altered copy of LC 9.6.7 and reinstalled from Time Machine's backup from earlier today before I made the changes. It now sees my SDK and JDK and builds an Android standalone. Yes, JDK 8 is installed and has been for a long time.

This is the exact same copy I was using yesterday when I had the problem. I'm at a loss.

Edit: I wonder if wiping the SDK pref was actually the fix.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Thu Jun 30, 2022 11:11 pm

From memory, I think sdk 11 (and maybe 10) place the jdk differently... it's internal so you don't explicitly have to specify where the jdk is. Or something like that. It's been a while.

I just now selected (on linux, ymmv) the sdk at /home/mwieder/Android/Sdk and it (the preferences selector) automatically filled in the jdk location with my $JAVA_HOME location

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Common Android Deployment issues

Post by jacque » Fri Jul 01, 2022 5:46 pm

I don't think it was so much the change in the SDK version, but rather the requirement that we use Android Studio to manage SDKs. Studio places it's SDKs in the user library folder, where before I'd had it in one of my own folders. But I adjusted LC's prefs location some time ago.

My experience could also be due to using an RC copy of LC at first. When that didn't work I moved back to LC 9.6.7 and it still failed. My current theory is that 9.6.8 RC 2 damaged the prefs file somehow. But that's just a guess.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Fri Jul 01, 2022 6:43 pm

That.
Yeah - I've found that if I switch versions and I haven't already selected the sdk location in the newly-selected version I will lose the setting more often than not.

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: Common Android Deployment issues

Post by makeshyft » Tue Jan 10, 2023 4:33 am

Hello,

I've recently upgraded my pc and since then I've not been able to get android sdk to be recognized.
I've tried everything that is in this thread and i followed the lesson.
I'm on windows 11, 9.6.9 RC 2 ... have SDK 12 API 31 installed, AND the build and command tools installed as well
pointing to the C:\Users\tom\AppData\Local\Android\Sdk folder, which is what is in the box of the studio sdk manager,
Its all there
Still "not a valid SDK"
jdk folder is blank even though java 8 is installed.
I'm out of ideas. Please help.
TIA

Tom
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Tue Jan 10, 2023 6:32 am

Tom-

Try monkeypatching the IDE stacks. The following will at least give you reasonable clues about what's missing.

Look in the revDeployLibraryAndroid stack.
In the deployIsValidSDK handler uncomment all the validation strings and comment the "return false" statements.
Then in the deployAutoconfigure handler change the first conditional to

Code: Select all

if tSDK is not empty and deployIsValidSDK(tSDK) is not empty then
In stack revSaveAsAndroidStandalone in handler revSaveAsMobileStandalone
patch the code after the call to revIDEDeployAndroidIsValidSDK to

Code: Select all

   put revIDEDeployAndroidIsValidSDK(tPath) into tErrorMessage
   if tErrorMessage is not empty then # now returns an error string
      throw revIDELocalise("The chosen folder in Preferences -> Mobile Support" & \
            " is not a valid Android SDK because" && tErrorMessage & ". " &\
            "Please ensure you have installed it correctly," & \
            " and enabled support for") && revIDEDeployAndroidRequiredSDK()
   end if

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: Common Android Deployment issues

Post by makeshyft » Tue Jan 10, 2023 6:34 am

mwieder wrote:
Tue Jan 10, 2023 6:32 am
Tom-

Try monkeypatching the IDE stacks. The following will at least give you reasonable clues about what's missing.

Look in the revDeployLibraryAndroid stack.
In the deployIsValidSDK handler uncomment all the validation strings and comment the "return false" statements.
Then in the deployAutoconfigure handler change the first conditional to

Code: Select all

if tSDK is not empty and deployIsValidSDK(tSDK) is not empty then
In stack revSaveAsAndroidStandalone in handler revSaveAsMobileStandalone
patch the code after the call to revIDEDeployAndroidIsValidSDK to

Code: Select all

   put revIDEDeployAndroidIsValidSDK(tPath) into tErrorMessage
   if tErrorMessage is not empty then # now returns an error string
      throw revIDELocalise("The chosen folder in Preferences -> Mobile Support" & \
            " is not a valid Android SDK because" && tErrorMessage & ". " &\
            "Please ensure you have installed it correctly," & \
            " and enabled support for") && revIDEDeployAndroidRequiredSDK()
   end if
Thank you Sir I will be trying this tomorrow.
There is hope :)
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: Common Android Deployment issues

Post by makeshyft » Wed Jan 11, 2023 5:48 am

This worked perfectly to help me track down the problem.
so far no "tools" folder and no sdklib.jar found.
My plan is to replace these files manually.
The error message hack really helped.
lesson for us all to just incllude the error message.
Cheers,
Tom
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Common Android Deployment issues

Post by mwieder » Wed Jan 11, 2023 6:52 am

Ah... yes, I remember having to create a Tools folder manually.

Post Reply

Return to “Android Deployment”