2015-02-11 24 views
99

我想在我的項目中使用RecyclerViewLib,爲此我下載它並將其作爲模塊導入到我的項目中空的「hello world」Android項目。我使用過Android Studio 1.0.1使用SDK管理器V24,這是我的應用程序/的build.gradle錯誤:沒有這樣的屬性:GROUP for class:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 17 
buildToolsVersion "19.1.0" 

defaultConfig { 
    applicationId "com.example.mk.dragdrop4" 
    minSdkVersion 14 
    targetSdkVersion 17 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
} 

,這是我的圖書館/的build.gradle

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 17 
    buildToolsVersion "19.1.0" 

    defaultConfig { 

     minSdkVersion 7 
     targetSdkVersion 17 
     versionCode 1 
     versionName "1.0" 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile 'com.android.support:support-v4:20.0.0' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
} 

apply from: 'https://raw.github.com/twotoasters/gradle-mvn-push/master/gradle-mvn-push.gradle' 

但是,當我輸入我得到這個錯誤信息:

Error:No such property: GROUP for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer 

任何人都可以幫我解決這個問題嗎?

回答

240

刪除此行從上的build.gradle指定的項目

apply from: 'https://raw.github.com/twotoasters/gradle-mvn-push/master/gradle-mvn-push.gradle' 
+4

喜@goonerdroid這是工作註釋此行謝謝。但是你能解釋更多關於這條線的信息嗎? – max 2015-02-11 09:41:49

+7

圖書館有gradle任務上傳到Maven存儲庫,需要爲gradle環境設置一些屬性,在您的項目中,你不需要/需要。 – goonerDroid 2015-02-11 09:48:47

+7

幫了我兩次:) – NarendraJi 2015-11-06 07:51:51

43

我經歷了非常類似的問題。

我想包括QuickReturn功能到應用中:https://github.com/felipecsl/QuickReturn

我使用的是Android 1.0影城後,我導入庫到我的項目,它給了我同樣的錯誤。然後,我看了庫的build.gradle文件,並刪除了這一行,它的工作原理如下:

apply from: 'gradle-mvn-push.gradle' 
+0

這個項目或者你剛剛導入的模塊,它也有一個gradle文件,這行代碼可以在gradle文件中找到,只需按照@ Simon的建議和你Thanx simon。 – 2015-09-03 10:28:20

+0

這是唯一的解決方案嗎? – 2016-03-06 23:12:27

+0

這對我有效,謝謝 – Ujjwal 2016-07-25 14:20:41

10

類似的問題。

刪除線:

apply from: 'maven-push.gradle' 

從的build.gradle,並能成功同步。

+0

這樣做對我有效。沒有這個聲明的後果是什麼? – 2017-01-18 15:23:55

+0

我沒有在我的任何build.gradle文件中看到這一行,我該怎麼做? – 2017-03-22 12:19:11

0
buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' // include latest gradle version and if project build with older version can update or can user same version 

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

allprojects { 
    repositories { 
     mavenCentral() 
    } 
} 
相關問題