Description
Project setup fails when using Android Code Studio with Android SDK Platform 37 installed.
Environment
Android Code Studio: v1.0.0+gh.r3 (com.tom.rv2ide)
Android SDK: android-37
OS: Linux (/opt/android-sdk)
Error
java.lang.NumberFormatException: For input string: "37.0"
at java.lang.Integer.parseInt(Integer.java:781)
at com.tom.rv2ide.xml.internal.versions.ApiVersionsParser.parseAttrs(ApiVersionsParser.kt:175)
Root Cause
The Android 37 SDK introduces values in api-versions.xml such as:
However, ApiVersionsParser currently parses version values using:
Integer.parseInt(value)
or .toInt(), which fails when encountering decimal strings like "37.0".
Impact
Project setup fails immediately
Any project using Android 37 SDK cannot be opened in the IDE
Prevents adoption of latest Android SDK
Suggested Fix
Replace strict integer parsing with a more tolerant parser.
Option 1 (simple fix)
value.substringBefore('.').toInt()
Option 2 (safer)
value.toFloat().toInt()
Option 3 (most robust)
private fun parseApi(value: String?): Int {
if (value.isNullOrBlank()) return -1
return Regex("\d+").find(value)?.value?.toIntOrNull() ?: -1
}
Then replace all occurrences of:
Integer.parseInt(...)
.toInt()
in ApiVersionsParser.kt with this helper method.
Notes
This issue likely affects not only since attributes but also other API version fields such as deprecated and removed if they also follow the same format in future SDK releases.
Expected Behavior
The IDE should correctly parse:
37
37.0
37.1
without crashing during project setup.
Description
Project setup fails when using Android Code Studio with Android SDK Platform 37 installed.
Environment
Android Code Studio: v1.0.0+gh.r3 (com.tom.rv2ide)
Android SDK: android-37
OS: Linux (/opt/android-sdk)
Error
java.lang.NumberFormatException: For input string: "37.0"
at java.lang.Integer.parseInt(Integer.java:781)
at com.tom.rv2ide.xml.internal.versions.ApiVersionsParser.parseAttrs(ApiVersionsParser.kt:175)
Root Cause
The Android 37 SDK introduces values in api-versions.xml such as:
However, ApiVersionsParser currently parses version values using:
Integer.parseInt(value)
or .toInt(), which fails when encountering decimal strings like "37.0".
Impact
Project setup fails immediately
Any project using Android 37 SDK cannot be opened in the IDE
Prevents adoption of latest Android SDK
Suggested Fix
Replace strict integer parsing with a more tolerant parser.
Option 1 (simple fix)
value.substringBefore('.').toInt()
Option 2 (safer)
value.toFloat().toInt()
Option 3 (most robust)
private fun parseApi(value: String?): Int {
if (value.isNullOrBlank()) return -1
return Regex("\d+").find(value)?.value?.toIntOrNull() ?: -1
}
Then replace all occurrences of:
Integer.parseInt(...)
.toInt()
in ApiVersionsParser.kt with this helper method.
Notes
This issue likely affects not only since attributes but also other API version fields such as deprecated and removed if they also follow the same format in future SDK releases.
Expected Behavior
The IDE should correctly parse:
37
37.0
37.1
without crashing during project setup.