简体   繁体   English

将外部库添加到android studio 0.5.1项目中

[英]Add external library into android studio 0.5.1 project

I'm using an external library SVProgressHUD in my Android studio project as a module. 我在Android Studio项目中使用外部库SVProgressHUD作为模块。 Everything is fine until I upgraded my Android studio to 0.5.1. 一切正常,直到我将Android Studio升级到0.5.1。 It always shows the follow error message: 它始终显示以下错误消息:

Error:(7, 17) package org.lcsky does not exist 错误:(7,17)包org.lcsky不存在

Here is my settings.gradle: 这是我的settings.gradle:

include ':app',':SVProgressHUD'

My build.gradle in project folder: 我的build.gradle在项目文件夹中:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

My build.gradle in SVProgressHUD module: 我在SVProgressHUD模块中的build.gradle:

apply plugin: 'android' 应用插件:“ android”

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
}

The build.gradle in my main module: 我的主模块中的build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.0'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':SVProgressHUD')
}

The gradle-wrapper.properties gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

Can anybody tell me what could be wrong? 有人可以告诉我什么地方可能出问题吗? Thanks 谢谢

I solved the problem by changing the build.gradle in SVProgressHUD module: 我通过更改SVProgressHUD模块中的build.gradle解决了该问题:

apply plugin: 'android-library'

Previously it works (before Android 0.5.1) when I set it to: 以前,当我将其设置为时,它可以工作(在Android 0.5.1之前):

apply plugin: 'android'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM