Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

[Bug]: Project initialization fails if the AGP version contains letters like "8.2.0-rc02" #1440

@Rafael2616

Description

@Rafael2616

What happened?

When trying to use versions of the Android Gradle Plugin that have letters like rc versions, the project even shows that it was configured successfully, but it is not possible to compile the app, due to the following stacktrace

The error appears to be in this file that converts the version name to an integer value

https://github.com/AndroidIDEOfficial/AndroidIDE/blob/dev/subprojects/tooling-api/src/main/java/com/itsaky/androidide/tooling/api/util/versions.kt#L32

and in this file that calls the function above

https://github.com/AndroidIDEOfficial/AndroidIDE/blob/dev/subprojects/tooling-api-impl/src/main/java/com/itsaky/androidide/tooling/impl/internal/AndroidProjectImpl.kt#L166

What's the expected behavior?

Build applications using rc versions, alpha in agp, normally

What version of AndroidIDE you're using?

v2.6.0 (debug builds)

Relevant log output

ToolingApiErrorStream E Nov 09, 2023 2:29:49 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError ToolingApiErrorStream E SEVERE: Internal error: java.lang.NumberFormatException: For input string: "0-rc02" ToolingApiErrorStream E java.util.concurrent.CompletionException: java.lang.NumberFormatException: For input string: "0-rc02" ToolingApiErrorStream E	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ToolingApiErrorStream E	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ToolingApiErrorStream E	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ToolingApiErrorStream E	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ToolingApiErrorStream E	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ToolingApiErrorStream E	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ToolingApiErrorStream E	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ToolingApiErrorStream E	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ToolingApiErrorStream E	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ToolingApiErrorStream E Caused by: java.lang.NumberFormatException: For input string: "0-rc02" ToolingApiErrorStream E	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) ToolingApiErrorStream E	at java.base/java.lang.Integer.parseInt(Integer.java:668) ToolingApiErrorStream E	at java.base/java.lang.Integer.parseInt(Integer.java:786) ToolingApiErrorStream E	at com.itsaky.androidide.tooling.api.util.VersionsKt.compareSemanticVersions(versions.kt:32) ToolingApiErrorStream E	at com.itsaky.androidide.tooling.impl.internal.AndroidProjectImpl.getModelSyncFiles$lambda$9(AndroidProjectImpl.kt:166) ToolingApiErrorStream E	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ToolingApiErrorStream E	... 6 more ToolingApiErrorStream E FieldAttributes E Unable to transform project FieldAttributes E org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. FieldAttributes E	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(Unknown Source:54) FieldAttributes E	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(Unknown Source:26) FieldAttributes E	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(Unknown Source:46) FieldAttributes E	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(Unknown Source:89) FieldAttributes E	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(Unknown Source:7) FieldAttributes E	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) FieldAttributes E	at java.util.concurrent.FutureTask.run(FutureTask.java:266) FieldAttributes E	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) FieldAttributes E	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) FieldAttributes E	at java.lang.Thread.run(Thread.java:764) FieldAttributes E Caused by: java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. FieldAttributes E	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:359) FieldAttributes E	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1921) FieldAttributes E	at com.google.gson.FieldAttributes.transform(SourceFile:1) FieldAttributes E	at com.google.gson.FieldAttributes.transform(SourceFile:5) FieldAttributes E	at com.itsaky.androidide.projects.ProjectManagerImpl$setupProject$2$1.invokeSuspend(Unknown Source:110) FieldAttributes E	at com.itsaky.androidide.projects.ProjectManagerImpl$setupProject$2$1.invoke(Unknown Source:12) FieldAttributes E	at kotlin.ResultKt.startUndispatchedOrReturn(Unknown Source:4) FieldAttributes E	at kotlin.io.ByteStreamsKt.withContext(Unknown Source:95) FieldAttributes E	at com.itsaky.androidide.projects.ProjectManagerImpl.setupProject(Unknown Source:128) FieldAttributes E	at com.itsaky.androidide.activities.editor.ProjectHandlerActivity$onProjectInitialized$1.invokeSuspend(Unknown Source:43) FieldAttributes E	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8) FieldAttributes E	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:109) FieldAttributes E	at androidx.work.Worker$2.run(Unknown Source:15) FieldAttributes E	at kotlinx.coroutines.scheduling.TaskImpl.run(Unknown Source:2) FieldAttributes E	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:93) FieldAttributes E FieldAttributes E StopWatch D Transform project proxy completed in 1265ms EditorActivity W GradleProject not initialized. Skipping initial setup... EditorActivity D onBuildStatusChanged: isInitializing: false, isBuildInProgress: false EditorActivity D [onPause] Opened files cache reset to OpenedFilesCache(selectedFile=/storage/emulated/0/AndroidIDEProjects/TicTacToeYou/build.gradle.kts, allFiles=[OpenedFile(filePath=/storage/emulated/0/AndroidIDEProjects/TicTacToeYou/build.gradle.kts, selection=Range(start=Position(line=4, column=54, index=218), end=Position(line=4, column=54, index=218)))]) ActionUtils E Cannot run application. No application modules found in project. StopWatch D Action 'ide.editor.build.quickRun' completed in 37ms

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions