0

I have an android gradle project which I compile from the command line. I am using eclipse + eclim to have autocompletion and source code validation. I was an unable to get code completion to work by importing the project as an gradle project into eclipse. I therefore imported /path/to/gradle/project/app/src/main as an android project into eclipse and after some .classpath tweaking I was able to get autocompletion to work.

Now I wanted to import the following android support libraries:

import android.support.annotation.NonNull;
import android.support.v13.app.FragmentCompat;
import android.support.v4.app.ActivityCompat;

but got The import ... cannot be resolved error for all three lines. I then tried Android Tools -> Add Android Support Library which failed miserably. I then tracked down the libraries in question in the Android-SDK and added them manually to the Java Build Path in Eclipse. For some I needed to extract the JAR files from the AAR files as described in this answer. I added the following libraries:

appcompat-v7-26.0.0-alpha1.jar
support-annotations-26.0.0-alpha1.jar
support-v4-26.0.0-alpha1.jar
support-v13-26.0.0-alpha1.jar

This solved the problem for the the first two imports but I still get the error for import android.support.v4.app.ActivityCompat;. I have code completion up to v4 but app is not found.

How can I resolve this issue? Am I still missing some dependency? Is there a better way to get android code completion with eclim?

rex123
  • 371
  • 3
  • 16
  • I would suggest using Android Studio. Google stopped supporting Eclipse for the development of Android apps almost two years ago. Android studio has autocompletion and source code validation build in. – Rockney Jun 30 '17 at 22:26
  • @Rockney Well then I don't have autocompletion in vim via eclim anymore. But I essentially want to know if it is still possible to use eclim with android or if everything has to go via Android Studio these days. – rex123 Jul 01 '17 at 10:58
  • I don't know a lot about vim, but it will get harder to use Eclipse for Android development, because they stopped supporting it. I would suggest checking if it is possible to integrate Android studio with vim. You might find these links usefull https://github.com/JetBrains/ideavim, https://www.jetbrains.com/help/idea/2017.1/using-intellij-idea-as-the-vim-editor.html – Rockney Jul 01 '17 at 12:22

1 Answers1

0

So i figured it out myself. There was still a dependency missing. In my case I also needed

 support-compat-26.0.0-alpha1.jar

I wrote this script to extract all the jar class files that are somewhere hidden in the android-sdk/folder. It recursivly looks at all subdirectories of the specified Android SDK folder until it either finds a JAR file which is not Javadoc or Source and copies it to a destination directory. If an AAR file is found the content is extracted to a folder of the same name as described in the link of the question and the JAR file in that folder copied with an appropriate name to the given destination directory.

rex123
  • 371
  • 3
  • 16