I am getting strange error on android studio - android

Please any one help me.
This is the error: Error:No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
stacktrace
Information:Gradle tasks [:app:compileDebugJava]
Information:FAILURE: Build failed with an exception.
Information:* What went wrong:
Information:A problem occurred configuring project ':app'.
Information:> A problem occurred configuring project':libraries:HoloColorPicker- master'.
Information: > No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Information:* Try:
Information:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:0 errors
settings.gradle
include ':app'
include ':libraries:HoloColorPicker-master'
build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:19.+'
compile project(':libraries:HoloColorPicker-master')
}
Holopicker build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
def isReleaseBuild() {
return version.contains("SNAPSHOT") == false
}
allprojects {
version = VERSION_NAME
group = GROUP
repositories {
mavenCentral()
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "18.1.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
apply from: 'maven_push.gradle'

The HoloColorPicker library has gradle tasks for uploading to the Maven repository that require some properties to be set for the gradle environment (usually in gradle.properties).
The easiest solution would be to remove the line from build.gradle:
apply from: 'maven_push.gradle'

I have not try the solution given by myanimal, but i have try out another thing which works with all the project which have similar issue during importing it. myanimal's solution is related to only one project, and for every project you should have to follow same thing.
But with my solution you might have to do it only once for all future projects.
For my solution do like below:
- create a file ~/.gradle/gradle.properties with the following contents:
nexusUsername=
nexusPassword=
Hope this will help you more for all projects.

Related

Convert project from Android Studio version 2 to 3- problem with configuration

I have problem with configuration of android project. I upgraded Android Studio [AS] from v2 to v3 and got many problems. I changed gradle as is in documentation:
gradle-wrapper, gradle plugin version, repositories google or jcenter instead of maven. Please look at configuration:
I have project called mytwayapp which have build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
//{ url "http://jcenter.bintray.com/" }
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
dependencies {
implementation project(':app')
}
Next I have module called app with build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '27.0.3'
// buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.mytway.activity.registerformactivity"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false;
javaMaxHeapSize "2g"
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/res/assets/fonts'] } }
testOptions {
unitTests.returnDefaultValues = true
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services:8.4.0'
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:support-v4:23.1.1'
implementation 'com.android.support:support-v13:23.1.1'
implementation 'joda-time:joda-time:2.9.4'
implementation files('../libs/MPAndroidChart-v3.0.1.jar')
//to remove when Dex is over memory
testImplementation group: 'org.powermock', name: 'powermock-api-easymock', version: '1.6.6'
testImplementation 'org.powermock:powermock-mockito-release-full:1.5.4'
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.5.1'
testImplementation 'org.mockito:mockito-all:1.9.5'
testImplementation 'org.powermock:powermock-mockito-release-full:1.6.1'
testImplementation 'org.easymock:easymock:3.1'
// testCompile files('build/lib/powermock-easymock-1.6.6-full.jar')
testImplementation 'junit:junit:4.12'
}
Next is gradle-wrapper:
#Thu Mar 16 20:14:22 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Problem:
I cannot sync with gradle,If I try then error:
Could not initialize class com.android.tools.idea.gradle.eclipse.GradleImport
When I try install from cmd, then:
./gradlew install -x test
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\android\BitBucket\mytwayapp\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'mytwayapp'.
> Could not find method implementation() for arguments [project ':app'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
It means that problem is with main build.gradle with dependencies to ":app" but it looks good.
I tried refreshed, rebuild, invalidate, restarted and still have a problem.
Project structure looks strange here is a screen:
ANSWER:
Tips from below are not worked, I downgrade Android Studio from 3.4 to 3.1 and after some cosmetics change it compile. Thanks for your time.
Try to update to latest versions:
dependencies {
classpath 'com.android.tools.build:gradle:x.x.x'
}
And buildToolsVersion in build.gradle
Try change de compileSDkVersion and targetSdkVersion with the same number prefix of buildToolsVersion in app gradle file, like this:
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
// buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.mytway.activity.registerformactivity"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
}

Unable to publish Android library project on JitPack

I made a small library for Android which I uploaded on my public Github repositroy. The library project contains also a sample app. To enable building on JitPack I followed JitPack's own instructions.
Now that i try build it remotely with JitPack i get following error:
WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/
Adding maven plugin
Found android library build file in Library
Running: gradle clean -Pgroup= -Pversion=v1.2 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Gradle version Gradle 3.1
FAILURE: Build failed with an exception.
* What went wrong:
Task 'clean' not found in root project 'build'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.532 secs
EXIT_CODE=1
2017-03-22T19:01:33.352614259Z
Exit code: 1
No build artifacts found
Here is the root build file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Build file for the library:
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group=
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
}
}
Build file for the sample app:
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId
minSdkVersion 15
targetSdkVersion 25
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:25.2.0'
compile project(':Library')
}
The project is missing a settings.gradle file where you include the library:
include ':Library'
Would also recommend adding the gradle wrapper so that JitPack builds with the correct Gradle version.
Example project: https://github.com/jitpack/android-example

Android Studio 0.8.6 Gradle project sync failed

I just installed the last Android Studio 0.8.6(beta) on my MacOSx Snow leopard. After creating a basic project, I have an error message
Gradle project sync failed ....
I added the mavenCentral() to repositories, in my build.gradle file. But it does not fix it:
this is my build.gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
The build.gradle in my android project looks like:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
applicationId "app.helloworld"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
Using the command line :
./gradlew assembleDebug --stacktrace
I otain this error message:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'HelloWorld'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:0.12.2.
Required by:
:HelloWorld:unspecified
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
Thanks for your answer.

Unable to build with Support Library on Travis CI/Android SDK v20

I hope this shouldn't be too challenging, but:
Currently I'm trying to build a project in Android/Travis CI, which you can find over here. I'm trying to use the Android L developer preview, and build with Travis-CI. I was hoping that using the Gradle SDK Manager plugin would allow me to do this. Unfortunately, it doesn't. I don't know if my build.gradle file is set up improperly, or what, but I was hoping someone might be able to point me in the right direction.
Build error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_testConfigDebugCompile'.
> Could not find any version that matches com.android.support:appcompat-v7:20.+.
Required by:
MinimalBible:app:unspecified
build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'org.bspeice.minimalbible'
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.squareup.dagger:dagger:1.2.1'
provided 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.android.support:appcompat-v7:20.+'
}
Let me know if any further information is required.
try something like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//force complie with 20.0.0
compile ('com.android.support:appcompat-v7:20.0.0'){force = true}
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
}

Gradle failed to refresh Android Studio

Ive been installing and re-installing AndroidStudio since i keep getting the error
> Gradle 'android' project refresh failed:
> Open quote is expected for attribute "{1}" associated with an element type "language".
All of my group members can open up the project without receiving this error except me.I am in dire need of help,i just want to finish my group project for the semester.Thank you for your help.
settings.gradle
include ':app'
build.gradle in the app folder
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 16
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 'com.google.android.gms:play-services:4.3.23'
compile 'com.android.support:support-v4:18.0.0'
files('libs/json-simple-1.1.1.jar')
compile files('libs/json-simple-1.1.1.jar')
}
build.gradle in the gradle folder
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Update:did another re-intstall of Android Studio and now its giving me this error.
Failed to refresh Gradle project 'android'
Out of memory: Java heap space. Configure Gradle memory settings using '-Xmx' JVM option (e.g. '-Xmx2048m'.)
Please fix the project's Gradle settings.
Gradle settings
You might have typed closed quote (“) instead of open quote("). Change the quotes at start and end of attribute.

Categories

Resources