无法在Android工作室中添加ozodrukh的CircularReveal库

问题描述 投票:1回答:3

我正在使用Android Studio 1.1.0并且我正在尝试添加CircularReveal库。我已按照其中提到的说明进行操作。

我的build.gradle(Module: app)是:

 apply plugin: 'com.android.application'

    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.1"

        defaultConfig {
            applicationId "com.geronimo.myapplication"
            minSdkVersion 18
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile 'com.github.ozodrukh:CircularReveal:(latest-release)@aar'
    }

I have added the repository in `build.gradle(Project: MyApplication3)`

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
    }
}

我得到的错误是

 D:\Workspaces\AndroidStudio\Studio1.0\MyApplication3\app\build.gradle
Error:(24, 13) Failed to resolve: com.github.ozodrukh:CircularReveal:(latest-release)
    <a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

我也尝试了依赖的变体,即:

compile 'com.github.ozodrukh:CircularReveal:(latest-release)@aar' 
compile 'com.github.ozodrukh:CircularReveal:(v1.0.4)@aar' 
compile 'com.github.ozodrukh:CircularReveal-v1.0.4 @aar'

该错误始终保持为Failed to resolve...

有没有其他方法可以导入远程aar文件并添加此依赖项?

android android-studio android-gradle
3个回答
1
投票

手动将@aar文件复制到libs目录。然后去

Files>Project Structure>Dependency

在右边的红十字会选择library dependency。这将提示您一个对话框,您可以在其中搜索您的依赖项并添加它们。

要么

从github下载circularReveal library并从Module Dependency导入Files>Project Structure>Dependency


0
投票

您只需要放置没有括号的版本号和'v'char com.github.ozodrukh:CircularReveal:1.0.4@aar


0
投票

我之前遇到过同样的问题。在我检查之后,我看到问题是miniSDKversion低于15.一旦我将它改为15,它就有效了。

minSdkVersion 14(将其更改为15或更高)targetSdkVersion 26

然后将其粘贴到库依赖项中

implementation ('com.github.ozodrukh:CircularReveal:2.0.1@aar') { transitive = true; }

还要添加远程maven url

repositories {
    maven {
        url "https://jitpack.io"
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.