我正在尝试将项目导入Android Studio。我得到了奇怪的错误。
Information:java: Errors occurred while compiling module 'library'
Information:Compilation completed with 100 errors and 5 warnings in 26 sec
Error:(31, 31) java: package android.support.v4.view does not exist
/Users/clxxxii/Downloads/JakeWharton-ViewPagerIndicator-8cd549f/library/src/com/viewpagerindicator/TitlePageIndicator.java
在TitlePageIndicator类中,这些导入无效。
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;
Android studio识别android.support.v4.view。但不是ViewPager,ViewConfigurationCompat和MotionEventCompat。你知道问题是什么吗?
///////
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':android-sdks:extras:google:google_play_services:libproject:google-play-services_lib')
compile project(':Downloads:Android Group Chat App using Sockets:android-websockets-master')
compile project(':Downloads:JakeWharton-ViewPagerIndicator-8cd549f:library')
compile project(':Downloads:BaseGameUtils')
compile project(':Downloads:polljoy-android-master:PolljoySDK')
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
答案 0 :(得分:3)
您的gradle.build文件缺少这些:
dependencies {
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
}