Nerd in Action Code is poetry

Cannot resolve symbol 'CordovaActivity'

After I imported a cordova project into Android Studio, symbols of cordova classes cannot be resolved.

Softwares:

Problem:

Somehow, android studio cannot figure out the library project.

How to solve this:

  1. ionic platform add android
  2. Open android studio, and choose Import Non-Android Studio Project
  3. Select the root folder(usually platform/android)
  4. Use Gradle Wrapper? YES
  5. Change gradle plugin version from 0.10.+ to 1.0.0 in both build.gradle files
  6. Change buildToolsVersion from 19.0.0 to 19.1.0 in both build.gradle files
  7. Remove the for loop in dependencies section of build.gradle, then add compile project(':CordovaLib')
  8. Remove the for loop in settings.gradle, then add include ':CordovaLib'
  9. Resync the gradle, and it should work