[Partially Solved]SDK root & JDK path: None

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 9:20 am

FourthWorld wrote:
Wed Jul 21, 2021 12:55 am
I had thought that Lesson was updated some years ago, no?
1) There was a Lesson on just installing Android tools + JDK.

2) That was deprecated by a Lesson on installing Android Studio + JDK.

When 2) failed for me last year (and I saw lots of others had had the "JDK not found error"), in my attempts to get round this I found that Android Studio has for some years come with its own internal JDK. My suggestion is that LC re-work their own installation/setup routines to only need that JDK. Doing that should stop this error. The JDK version/place will be fixed, the user can't make a mistake.

Others have responded with "just use 1)". Such workarounds might help experienced/committed people. Who knows how many people hear "LC is a great free tool for Android development", install LC + Android Studio + JDK, then can't get it to work and just give up?

Others have just installed JDK 16 (I think) because that is the only one compiled for M1 chip. I'm happy for them that worked, but the most basic method provided by LC needs to be cross-platform and standard and less error prone.

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: SDK root & JDK path: None

Post by Jellobus » Wed Jul 21, 2021 4:35 pm

Bernard wrote:
Wed Jul 21, 2021 9:10 am
I was going to ask you to do the same with this command, but it fails through the IDE but not in a Terminal window.

/usr/bin/javac -version

I get this as a response:

javac 1.8.0_242-release
I get this in the terminal: javac 1.8.0_291

What should I do next?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: SDK root & JDK path: None

Post by FourthWorld » Wed Jul 21, 2021 4:58 pm

The version of the Lesson I'm seeing directs the user to install Android Studio SDK, and does not mention installing the JDK.

Did I overlook something?

https://lessons.livecode.com/m/2571/l/6 ... oid-studio
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 7:14 pm

Jellobus wrote:
Wed Jul 21, 2021 4:35 pm

I get this in the terminal: javac 1.8.0_291

What should I do next?
Well we know that Java 1.8 is installed and that the OS at least knows it's there.

"Second, I downloaded all required files from the SDK manager then I used shift+cmd+g and put /Users/myName/Library/Android/sdk to find SDK. and it failed."

I just encountered someone else here today who was having problems with the SDK. So let's tackle that next.

viewtopic.php?f=7&t=36121#p207247

It sounds like he (on Linux) was having a problem that was due to some missing files/tools in the SDK.

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 7:21 pm

FourthWorld wrote:
Wed Jul 21, 2021 4:58 pm
The version of the Lesson I'm seeing directs the user to install Android Studio SDK, and does not mention installing the JDK.

Did I overlook something?

https://lessons.livecode.com/m/2571/l/6 ... oid-studio
Yes :) Because the world of Java was meant to be some kind of BDSM dungeon.

Just like Java 8 is AKA "java 1.8.x_x", there's the Java JDK (Java Development Kit) and the Java SDK (Software Development Kit). The Lesson says to install "SDK", with the link pointing to files saying "Java SE Development Kit 8u301". And the Android Studio numbering is also fubar,

Again, with all that naming/numbering silliness, it would be better if LC just came up with a set of instructions that utilized the JDK that's inside Android Studio.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: SDK root & JDK path: None

Post by FourthWorld » Wed Jul 21, 2021 8:35 pm

Bernard wrote:
Wed Jul 21, 2021 7:21 pm
Again, with all that naming/numbering silliness, it would be better if LC just came up with a set of instructions that utilized the JDK that's inside Android Studio.
Unless I missed something, that appears to be what it does. References to separate JDKs are no longer there, as they're not needed.

If you're asking why LC can't go one step further to also use the SDK defaults, without requiring using the SDK tools to add additional packages, that would be handy indeed. But I'm pretty sure they didn't stay up late thinking of extra steps for no reason; I'll bet it has something to do with the scope of features the LC engine relies on. Don't know the specifics; perhaps someone from the team or should engine contributor familiar with Android SDK requirements can offer more details if needed.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: SDK root & JDK path: None

Post by Jellobus » Wed Jul 21, 2021 8:37 pm

Hi Bernard,

I was able to see the script below after following your suggestion in the other thread

viewtopic.php?f=7&t=36121#p207247

Code: Select all

on mouseUp
   answer folder "Please choose the location of your Android development SDK"
   if it is not empty then
      if revIDEDeployAndroidIsValidSDK(it) then
         setAndroidSDK it
      else
         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
If you put a breakpoint you should be able to trace through revIDEDeployAndroidIsValidSDK(it) and find where/why it is failing.
The thing is that I don't know how to trace revIDEDeployAndroidIsValidSDK(it) with a breakpoint. Sorry, but would you tell me how to do? I don't have enough programming knowledge like the guy in the other thread. but I really like to fix this problem and make Android apps.

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 11:18 pm

The problem the user had in the other discussion was files missing from inside Android Studio. One really wouldn't expect that to happen!

What version of Android Studio do you have installed?

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 11:21 pm

FourthWorld wrote:
Wed Jul 21, 2021 8:35 pm
Bernard wrote:
Wed Jul 21, 2021 7:21 pm
Again, with all that naming/numbering silliness, it would be better if LC just came up with a set of instructions that utilized the JDK that's inside Android Studio.
Unless I missed something, that appears to be what it does. References to separate JDKs are no longer there, as they're not needed.
Richard, your eyesight must be getting as bad as mine ;)

From the link you provided:
You need to download and install Java SDK version 8, if you already have Java 9 or 10 installed you will need to uninstall these and reinstall Java 8. You can download Java 8 here.

You will need to download the Android Studio SDK, here.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: SDK root & JDK path: None

Post by FourthWorld » Wed Jul 21, 2021 11:33 pm

Good catch, Bernard. I should know better than to try to do a critical review of a document from the tiny window of my phone.

I just did what apparently hadn't been done before to address the issue at the source: I submitted a bug report in the form of a comment on that page.

The team periodically updates it to remain current, and hopefully they'll bring it up to reflect the latest requirements soon.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Wed Jul 21, 2021 11:48 pm

FourthWorld wrote:
Wed Jul 21, 2021 11:33 pm
Good catch, Bernard. I should know better than to try to do a critical review of a document from the tiny window of my phone.

I just did what apparently hadn't been done before to address the issue at the source: I submitted a bug report in the form of a comment on that page.

The team periodically updates it to remain current, and hopefully they'll bring it up to reflect the latest requirements soon.
Thanks :) It's a cold day in hell when I try to read anything on a mobile phone!

But if you scroll up the comments, I think you'll find I notified them last year. I even got a "thanks" from one of the team for my link to the steps I put here on the forum.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: SDK root & JDK path: None

Post by FourthWorld » Thu Jul 22, 2021 12:12 am

Same issue? Dismaying.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Thu Jul 22, 2021 7:02 am

Well it appears there are a few issues people have with Android Studio. But by far the most common is the JDK not being found. Since there is a canonical JDK version inside AS then that canonical version of the JDK is in a known location once AS is installed on each platform. To my mind using that JDK is going to be a simpler solution than the current Lesson. I think there are at least half a dozen threads on the forum about the JDK not being found. I'd guess we can multiply that for all those people who try out LC have this fail and never come here to look for help.

I wrote up my findings here, which Klaus at least found useful in getting AS and LC to work together. But it's clear those findings are not simple enough for more novice users to follow. So I think LC should re-work the setup/config code in LC to point to the AS JDK so there should be less frustration from users.

Annoyingly enough, once it's all working I don't ever even start up AS, so there's 100s of MBs of wasted space with AS. But there are some parts that need to be installed and in the right places for LC to find and execute in compiling apps to go straight onto an actual mobile device.

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: SDK root & JDK path: None

Post by Jellobus » Thu Jul 22, 2021 5:04 pm

Bernard wrote:
Wed Jul 21, 2021 11:18 pm
What version of Android Studio do you have installed?
I installed Android Studio 4.1

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: SDK root & JDK path: None

Post by Bernard » Thu Jul 22, 2021 6:44 pm

That's what I have installed. But since we are at different javac versions, it suggests your javac is not the same as the one in AS 4.1 (as that's the only java I have installed).

I assume you can start Android Studio, showing the install is OK.

What happens when you go to Livecode Preferences/Mobile Support and select the path for "Location of Android development SDK root"?

Post Reply

Return to “Android Deployment”