Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid revision: 3.18.1 CMake in Android Studio

This is not a question, it is a solution for a technical problem with android studio which I have meet. I will share my doing to fix the error if any one would encounter. The brief error message is: "Invalid revision: 3.18.1-g262b901", while 3.18.1 is latest CMake version in Android studio. But the problem is my project is old and it builds failed with this CMake version. There are 2 solutions, you can choice 1 in 2: -Remove(uninstall) CMake version 3.18.1: Click Android Studio->Preferences->Appearance & Behavior->System Settings->Android SDK->SDK Tool->(enable the Show Package Details checkbox)->CMake->Uncheck 3.18.1 checkbox, then click Apply button in right-bottom conner of dialog. -Set directory path of lower-version CMake in the local.properties file by adding this line to this file: cmake.dir=/Users/admin/Library/Android/sdk/cmake/3.10.2.4988404 (The CMake path can be different in your computer)

Long error message(a small part):

*

at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
Caused by: java.lang.NumberFormatException: Invalid revision: 3.18.1-g262b901
    at com.android.repository.Revision.parseRevision(Revision.java:133)
    at com.android.repository.Revision.parseRevision(Revision.java:155)
    at com.android.build.gradle.external.cmake.CmakeUtils.getVersion(CmakeUtils.java:51)
    at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.createCmakeExternalNativeJsonGenerator(ExternalNativeJsonGenerator.java:688)

Hope it help!

like image 990
Cuong Do Avatar asked Mar 09 '21 04:03

Cuong Do


Video Answer


1 Answers

Downgrading CMake solves this issue (but it's a workaround).

  1. Android Studio > Tools > SDK Manager
  2. Click SDK Tools tab
  3. Check Show Package Details
  4. Expand CMake
  5. Select a lower version
  6. Update local.properties path to the new version

Downgrading CMAKE

enter image description here

like image 143
Stefan Avatar answered Oct 04 '22 20:10

Stefan