Kotlin || 无法将库添加到我的应用程序?
我正在尝试将库添加到Kotlin
但它没有得到正确的安装。
以下错误我正在导入库,请检查它
错误:找不到com.android.tools.build:gradle:2.3.1。 在以下位置搜索:file:/ C:/ Program Files / Android / Android Studio Preview / gradle / m2repository / com / android / tools / build / gradle / 2.3.1 / gradle-2.3.1.pom文件:/ C :/ Program Files / Android / Android Studio Preview / gradle / m2repository / com / android / tools / build / gradle / 2.3.1 / gradle-2.3.1.jar https://repo1.maven.org/maven2/com/ android / tools / build / gradle / 2.3.1 / gradle-2.3.1.pom https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1 .jar需求:project:slidingmenulib
我正在使用下面的Project build.gradle
,请检查一次
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.1.3-2' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-alpha9' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir }
和我的模块gradle,如下所示:
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.zargow.kotlin" minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.0', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.0.0-beta2' testImplementation 'junit:junit:4.12' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:recyclerview-v7:26.0.0-beta2' compile 'com.github.bumptech.glide:glide:3.8.0' compile 'org.jetbrains.anko:anko-design:0.8.3' compile 'com.squareup.okhttp3:okhttp:3.8.1' compile 'com.android.support:cardview-v7:26.0.0-beta2' compile 'com.android.support:design:26.0.0-beta2' compile 'de.hdodenhof:circleimageview:2.1.0' implementation 'com.android.support:design:26.0.0-beta2' }
我正在使用图书馆的滑动菜单,请点击这里 。这个库我需要导入到我的kotlin项目,但得到错误。
请帮我解决这个问题。 谢谢
在progect gradle文件中使用
allprojects { repositories { google() jcenter() mavenCentral() maven { url "http://jzaccone.github.io/SlidingMenu-aar" } } }
并在应用程序中加入
dependencies { .... compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar' }
- Kotlin匕首2 Android ViewModel注入错误
- Kotlin和Android数据绑定(BuildTools 2.0.0)
- Kotlin android parcelable
- 从Observable获取结果 – Kotin Android
- 访问android.os.storage.StorageVolume
- 没有类的Android应用程序?
- 在Android Studio 3.0 Canary中,Gradle Sync失败
- Kotlin在Android Studio上运行失败提示“Gradle同步失败:连接超时:连接请参阅IDE日志以获取更多详细信息(帮助|显示日志)”
- Firebase和检索元素