Android Studio не импортирует библиотеки
Я пытаюсь использовать Bottom Sheet для своего проекта из этого сайта https://medium.com/android-bits/android-bottom-sheet-30284293f066. На сайте сказано, что необходимо подключить библиотеку в ваш проект:
dependencies {
//replace X.X.X with the latest version
compile 'com.android.support:appcompat-v7:X.X.X'
compile 'com.android.support:design:X.X.X'
}
Для подключения я проделываю след. манипуляции:
- Заходим в
File -> Project Structure -> Dependencies,нажимаем+, с помощьюsearchнаходим необходимые библиотеки. Подтверждаем все и закрываемProject Structures. Прописываем в конфиге
build.gradledependencies { //replace X.X.X with the latest version implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' }
Я использую последнюю версии библиотеки, 28.0.0 последняя версия на данный момент.
В новой версии Android Studio вместо compile необходимо писать implementation.
Далее я нажимаю sync now.
После проделывания всех манипуляций, я захожу в MainActivity и импортирую следующие библиотеки:
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
свойстваgradle.properties:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
build.gradle моего проекта:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
а также build.gradle модуля:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.testgradle"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'
}
Все они начинают подчеркиваться красным светом. Я все еще не могу разобраться, что я упустил, какие манипуляции не проделал? Надеюсь вы поможете решить данную проблему.