Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to download and install SDK repeatedly #712

Open
dfkettle opened this issue Oct 16, 2022 · 7 comments
Open

Need to download and install SDK repeatedly #712

dfkettle opened this issue Oct 16, 2022 · 7 comments

Comments

@dfkettle
Copy link

dfkettle commented Oct 16, 2022

I'm not sure if this is expected behaviour or not, but every time I open Processing and select Android mode, I need to download and install the SDK. It's my understanding that you don't need to have Android Studio installed (which I don't), but if I have to go through all these steps every time, I may do that. I'm running Processing v4.0.1 under Windows 10.

When I select Android mode, I get this screen telling me that no SDK was found:

Image1

I select "Download SDK automatically" and the next two screens are eventually displayed:

Image2
Image3

Then, when I try to run my sketch in the emulator, I have to download and install the image for my device (it's the save device every time, a Samsung Galaxy Tab S6 Lite), as well as HAXM:

Image4
Image5

Here is the output from the console. (Strangely enough, the very last message says "HAXM: Intel HAXM reinstalled successfully!". So why is it necessary to reinstall, when it seems to recognize the fact that it's already installed?)

build.txt

After doing all this, I can run my sketch (the "Getting started" tutorial, https://android.processing.org/tutorials/getting_started/index.html) in the emulator. I'm still unable to run it on the device from within the IDE (I get a "lost connection" error, even though it's connected and I've allowed access in settings). However, if I copy the APK file to my device and install it, it runs. Is there something I'm doing wrong, or is it really necessary to install Android Studio, even though the tutorial seems to imply it isn't necessary?

Thanks.

@rupeshkumar22
Copy link
Contributor

@dfkettle Can you please share more information on versions of PDE and Android Mode that you are using? Also for the lost connection issue here are some points for which it can show a lost connection-

  • If your cable is connected to the device get connectionless for even a millisecond. Sometimes we don't even realize we moved the port a bit or it happens by itself because of the cable or little loose ports. The cable must not be loose or moved during build time.

  • The chances of a lost connection are more when installing SDK and image files because it takes a bit longer than usual for the first-time build

  • If you are using an emulator, make sure the emulator is properly booted and running before trying to run the sketch on the device.

  • I hope the USB debugging is on in the developer mode of the settings(Mostly you can confirm USB debugging is enabled in the notification bar). Have you checked if the device was shown on Android->Devices->(Your Device Name) before trying to run?

For the SDK downloading again and again I think I saw something similar maybe because SDK path was not getting stored properly in preferences.txt. #700 But there is a point that it stores the installed SDK path at the end when the SDK installation process goes successful and mainly after you close the ide properly(IDE EXIT). so that the next time it uses the path from preferences.txt. The error seems to be resolved in the recent versions of Android Mode and it's not happening for me now. For now, you can identify the SDK installed path and store it in the preferences.txt file as-
android.sdk.path=/sdkpath (Usually C:\Users\UserName\Documents\Processing\android\sdk in windows)
By saving the path in the preferences file it will use that SDK on startup.

Thanks,
Rupesh

@dfkettle
Copy link
Author

Processing 4.0.1 and Android mode 4.5.0b2 (the latest)

It looks as if the SDK path isn't getting saved, as you describe in issue #700 (I did exit properly). Here's the preferences.txt file, there is no entry "android.sdk.path". I'll try adding it manually and see what happens.

preferences.txt

I did enable USB debugging, and I don't think I touched the cable or the device when I tried to test it. Maybe there's a setting in Android that causes it to time out if there's no activity for a while?

How do I "make sure the emulator is properly booted and running before trying to run the sketch on the device"? And why does the emulator need to be running if I'm running the sketch on the device?

@dfkettle
Copy link
Author

dfkettle commented Oct 16, 2022

Adding the SDK path manually to preferences.txt didn't make any difference, I still had to re-install the SDK (and the device image).

However, I tried plugging the tablet into a different USB port and now "run on device" is working. Does it have to be a USB 3 port? Or maybe because I had it plugged into a USB hub. This time I plugged it directly into the laptop.

@rupeshkumar22
Copy link
Contributor

When you click on 'Run in emulator' option. The emulator will open up and show a logo. You need to wait for a few seconds until it shows the home screen. Yes, the emulator does not need to be running if you are running it on a device. Just that there can be a case of lost connection with the emulator when it's getting started So I mentioned that point.

You would have restarted the IDE after saving the path in preferences.txt file at C:\Users\Name\AppData\Roaming\Processing\preferences.txt
Have you inserted the path similar to this android.sdk.path=C:\Users\User\Documents\Processing\android\sdk in preferences.txt? The path I mentioned is based on windows which can be different based on OS.

One thing is that if any of the parts of the SDK was not downloaded properly last time, the PDE will not use that sdk path in preferences.txt file. instead will ask to install a new sdk. Do you see any temp folder besides the sdk folder, In the last part of the SDK installation the temp folder gets deleted and if you still see it that means the SDK was not installed properly?

It is not necessary to use only 3.0 USB. Glad that the sketch is running on the device now.

@dfkettle
Copy link
Author

Have you inserted the path similar to this android.sdk.path=C:\Users\User\Documents\Processing\android\sdk in preferences.txt?

Yes, here's the file after I added the path. I don't know if the lines need to be sorted alphabetically, but I added the line in the correct order just in case.

preferences.txt

In the last part of the SDK installation the temp folder gets deleted and if you still see it that means the SDK was not installed properly?

You're correct, the '.temp' folder is still there, although it's empty. So shouldn't this be considered a bug? No error message was displayed during the install process. In fact, a message box pops up at the end saying "Processing just downloaded and installed the Android SDK successfully" (see below). Are users supposed to know that they should look for a '.temp' folder in the installation directory? And even if they do know, what are they supposed to do about it, if no error messages were displayed? Is there a log file created somewhere by the install process that might give the user a clue as to what the problem might be?

Image3

@dfkettle
Copy link
Author

It seems that it's not just the install process that writes to the '.temp' folder. I removed Android mode, deleted the SDK install directory and deleted the lines in 'preferences.txt' related to the Android SDK. I then opened Processing and re-installed the SDK. Then I closed Processing (without running any tests) and checked to see if the '.temp' folder was still there. It wasn't! The SDK path had also been added to 'preferences.txt'. So it seems the install really was successful this time. Then I opened Processing and ran my sketch (I wasn't prompted to re-install the SDK). The test ran successfully, so I closed Processing. Then I went back to see if there was a '.temp' folder. There was! It looks as if it's also created when you run your sketch with the emulator, but it doesn't get deleted. I then opened Processing and ran my sketch again. I wasn't asked to re-install the SDK this time either, even though there was still a '.temp' folder in the installation directory. So I don't think it depends on whether the '.temp' folder has been deleted or not (IMHO, it would be a rather poor design decision if it did). But it still seems there's a problem with the install process. Sometimes it works (and adds the path to 'preferences.txt') and sometimes it doesn't, for some unknown reason, even though it displays the message telling the user it was successful. Without a log file to investigate, though, it's impossible to say what the problem might be.

@sadsochocked
Copy link

hi i have the same problem than you and a wanna now if you resolved it a year later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants