1

Android Studio で、Eclipse + ADT で開発されたプロジェクトをインポートし ( http://developer.android.com/intl/pt-br/sdk/installing/migrate.htmlで説明されているように)、Gradle ビルドが完了すると、 「import-summary.txt」には次のように書かれています。

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

しかし、のCirclePageIndicator.javaクラス内libraryViewPagerIndicatorでは、インポート段階でエラーがあります:

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

Gradle Build のメッセージは次のとおりです。

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.

SDK には Android サポート ライブラリが存在することに注意してください。 ここに画像の説明を入力してください。

だから私は疑問に思っています:

  • プロジェクトのインポート段階で何が問題になっていますか?
  • Android Studio でいくつかの設定を変更する必要がありますか?
4

1 に答える 1

0

libraryViewPagerIndicator モジュール build.gradle に v4 サポート ライブラリの依存関係を追加します。

于 2016-05-02T09:08:24.797 に答える