Search code examples
javaandroideclipse-lunaandroid-studio-2.1

Migrating from Eclipse ADT to Android Studio 2.1 - error: package android.support.v4.view does not exist


In Android Studio I imported the project developed with Eclipse + ADT (as described in http://developer.android.com/intl/pt-br/sdk/installing/migrate.html ), and once the Gradle build is finished, the "import-summary.txt" says:

Replaced Jars with Dependencies:
--------------------------------
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:

android-support-v4.jar => com.android.support:support-v4:18.0.0
gson-2.3.1.jar => com.google.code.gson:gson:2.3.1

Replaced Libraries with Dependencies:
-------------------------------------
The importer recognized the following library projects as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the source files in your project were of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the library replacement in the import wizard and try
again:

google-play-services_lib => [com.google.android.gms:play-services:+]
librarySherlok =>
    com.actionbarsherlock:actionbarsherlock:4.4.0@aar
    com.android.support:support-v4:18.0.0

But within the CirclePageIndicator.java class, of the libraryViewPagerIndicator, i have errors in the import phase:

import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;

where messages of Gradle Build are:

C:..\libraryViewPagerIndicator\src\main\java\com\viewpagerindicator\PageIndicator.java
error: package android.support.v4.view does not exist
.
.
error: cannot find symbol class ViewPager
error: package ViewPager does not exist
error: cannot find symbol variable ViewConfigurationCompat
error: cannot find symbol variable MotionEventCompat
.
.
error: method does not override or implement a method from a supertype
.
.
Error:Execution failed for task ':libraryViewPagerIndicator:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Note that in the SDK is present the Android Support Library: enter image description here

So I'm wondering:

  • What is wrong in the import phase of the project?
  • I have to change some settings in Android Studio?

Solution

  • add v4 support library dependency in libraryViewPagerIndicator module build.gradle