Android Question Should we keep all previous Android SDK version on our SDK path

Anser

Well-Known Member
Licensed User
Longtime User
Hi,

My folder containing Android SDK has reached almost 50 GB by now. This has grown to this size over a period of time. For eg:- When I started with B4A the Android ver was 5.1.1 ie API 22

Android SDK.jpg


As per my Android SDK Manager.

I have the following API versions installed on my PC ie

API 25
API 24
API 23
API 22
API 21
API 20
API 19

Now my question is Should I have all these previous Android API's on my Android SDK folder forever
OR
Can I keep only the latest one as of now, AP1 25 ie 7.1.1 and the rest can be uninstalled ?

Will removing all other API's cause any issue ?

Thanks in advance
 

Anser

Well-Known Member
Licensed User
Longtime User
Except the latest API version (as of now ie API 25), I uninstalled all the previous API versions. Now the Android SDK folder size came down to 12.9 GB from almost 50 GB.

So when ever a new API is released, we should install the latest and uninstall the previous API versions. This helps to maintain the Android SDK folder neat and clean.

Hope that the latest API is enough to compile and generate the APK. The generated APK will work on devices running current API version 25 and all previous API versions depending on the entry contained in my B4A Project's Manifest for eg android:minSdkVersion="14" android:targetSdkVersion="21"
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
I believe Anser is looking for confirmation of his last post, not making his own statement of confirmation. I too would appreciate the answer to his question.

Best regards
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
Be careful what you do here. I checked this out to see what would happen. If your manifest reads android:minSdkVersion="14" android:targetSdkVersion="21" and the only API you have is API 25, then your app will not compile, because API 21 is not found. If your targetSdkversion is always API 25 perhaps you are OK.
 
Upvote 0

Anser

Well-Known Member
Licensed User
Longtime User
Hope that the latest API is enough to compile and generate the APK. The generated APK will work on devices running current API version 25 and all previous API versions depending on the entry contained in my B4A Project's Manifest for eg android:minSdkVersion="14" android:targetSdkVersion="21"
Yes. This was my doubt and the one that required a clarification.

Be careful what you do here. I checked this out to see what would happen. If your manifest reads android:minSdkVersion="14" android:targetSdkVersion="21" and the only API you have is API 25, then your app will not compile, because API 21 is not found. If your targetSdkversion is always API 25 perhaps you are OK.
After removing all previous API versions from my Android SDK, its only today morning, I could try to compile one of my existing projects.
I was able to generate the APK without any errors. I wonder why it is not working for you and throwing errors. I am interested in knowing the reason why you are not able to compile the project after removing old Android API's from your Android SDK.

Here is the Manifest entry in my project regarding the Android version. As of now, I have only the API 25 installed in my Android SDK
B4X:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21"/>

I understand that the Virtual devices that I had no longer works. I believe that the reason is because the Virtual devices where created to use API 21 and below.
Emulator.png


Obviously, the Emulator can be created only for those API's installed in the Android SDK.

Correct me if I am wrong somewhere.

The size of the total Android SDK growing above 50 GB, and keeping all these on the hard drive, unless it is really necessary, doesn't look like a good idea. Hope these findings are going to be useful for other friends of this Forum.

Comments/suggestions/findings of other members are also welcome.

Regards

Anser
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Be careful what you do here. I checked this out to see what would happen. If your manifest reads android:minSdkVersion="14" android:targetSdkVersion="21" and the only API you have is API 25, then your app will not compile, because API 21 is not found. If your targetSdkversion is always API 25 perhaps you are OK.
That's not correct. Which error did you see?
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
Be careful what you do here. I checked this out to see what would happen. If your manifest reads android:minSdkVersion="14" android:targetSdkVersion="21" and the only API you have is API 25, then your app will not compile, because API 21 is not found. If your targetSdkversion is always API 25 perhaps you are OK.
This is not correct.

The only problem you will get if you delete older platform versions is when you want to create AVDs (Android Emulator). As I know you need the platform version installed if you want to create AVDs with older Platform APIs. But for the Android emulator I suggest to use something like Genymotion.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Whilst Erel is mostly correct (!) the question should be what and who are you targetting?

I've had a really quick scan of my App installs and I think that the most significant older version of Android my App is installed on is 4.4

There are a few hundred installs on 4.1 and 4.2 but anything prior to 4 seems to have little or no interest - I think all those prior to 4 total around 90 Users - less than one percent.

I only ever test on real devices and don't now set up AVDs.

I think the Android version was Froyo or Gingerbread when I started using B4A...
 
Upvote 0

William Hunter

Active Member
Licensed User
Longtime User
Genymotion.png
That's not correct. Which error did you see?
I have gotten a strange result in trying to duplicate the original error. It was different than the error I am now getting, unfortunately I didn't record it. It alluded to API 19 not found.

I again deleted API 19 from SDK MGR. I then used Compile & Run using a Genymotion emulator. I got the error below. I then reinstalled API 19 in the SDK, only to find the error persisted. I did not get this error until I made API deletions from the SDK. It seems that the current error is a Genymotion error. I don't know the reason for the error. Compile & Run is successful using an AVD Manager emulator. It seems the old saying "if it ain't broke don't fix it" applies here. As corwin42 has stated previously, removing older APIs from the SDK manager would only affect the creation of emulators. Question answered, but I still don't know why Genymotion has been adversely affected in all of this. Strange.

Regards
B4X:
B4A version: 6.80
Parsing code.    (0.00s)
Compiling code.    (0.06s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
Generating R file.    (0.64s)
Compiling generated Java code.    (1.32s)
Convert byte code - optimized dex.    (0.65s)
Packaging files.    (1.08s)
Copying libraries resources    (0.08s)
    Found 2 resource files.
Signing package file (private key)    (1.23s)
ZipAlign file.    (0.21s)
Installing file to device.    Error
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon

Edit:
After more research I've realized that Genymotion uses by default its own adb. This may have been changed when I today updated Genymotion.

I switched to my main adb and it solved the issue. I guess that because Genymotion's adb was launched first I got the Address already in use error message.
 
Last edited:
Upvote 0
Top