Android studio Error:Configuration with name 'debug' not found - android

I have a problem. When I want do Gradle project sync in my project, he write:
Error:Configuration with name 'debug' not found.
Only this one line, nothing more.
I don't know what he want from me.
Here is build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
apply plugin: 'android-library'
ext {
apply from: 'cordova.gradle'
cdvCompileSdkVersion = privateHelpers.getProjectTarget()
cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
targetSdkVersion 24
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

I started to experence the error since I had updated cordova-android to 6.0.0.
I overcame it by using
android {
publishNonDefault true
}
You can read about it here http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication

Related

Task 'prepareReleaseUnitTestDependencies' not found in project ':app'

I'm getting this error in console while building my android project. Please help me understand this.
Messages:
Error:FAILURE: Build failed with an exception.
What went wrong:
Task 'prepareReleaseUnitTestDependencies' not found in project ':app'.
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.
Gradle:
buildscript
{
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
//subprojects are added here
project(':external:calendar') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:colorpicker') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
}
project(':external:datetimepicker') {
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:timezonepicker') {
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:chips') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile project(':external:calendar')
compile project(':external:colorpicker')
compile project(':external:datetimepicker')
compile project(':external:timezonepicker')
compile project(':external:chips')
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
useLibrary 'org.apache.http.legacy'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'external/ex/common/java'] // NOTE: this includes external/ex/common/java!
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
/*
* To sign release build, create file gradle.properties in ~/.gradle/ with this content:
*
* signingStoreLocation=/home/key.store
* signingStorePassword=xxx
* signingKeyAlias=alias
* signingKeyPassword=xxx
*/
if (project.hasProperty('signingStoreLocation') &&
project.hasProperty('signingStorePassword') &&
project.hasProperty('signingKeyAlias') &&
project.hasProperty('signingKeyPassword')) {
println "Found sign properties in gradle.properties! Signing build…"
signingConfigs {
release {
storeFile file(signingStoreLocation)
storePassword signingStorePassword
keyAlias signingKeyAlias
keyPassword signingKeyPassword
}
}
buildTypes.release.signingConfig = signingConfigs.release
} else {
buildTypes.release.signingConfig = null
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
task customClean(type: Delete) {
delete rootProject.buildDir
}
clean.dependsOn customClean
perhaps you need to delete " -x prepareReleaseUnitTestDependencies" from :
Setting / build,execution, deployment/ compiler/ command-line Options
.

How to solve import org.apache.http.util cannot be resolved?

I changed the project build target in MainActivity- CordovaLib from android 5.1.1 to android 7.1.1. After changing the build target it shows an error in the src/CordovaResourceApi.java that the import org.apache.http.util cannot be resolved.
However when i change the build target back to 5.1.1 it does not show any error.
How do i solve this? Here is the build.gradle file in res/
buildscript {
repositories {
mavenCentral()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
if (gradle.gradleVersion >= "2.2") {
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+'
}
} else if (gradle.gradleVersion >= "2.1") {
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0+'
}
} else {
dependencies {
classpath 'com.android.tools.build:gradle:0.12.0+'
}
}
}
apply plugin: 'android-library'
android {
compileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion
publishNonDefault true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
Try adding the following in your gradle under android :
android {
useLibrary 'org.apache.http.legacy'
}
Put this value in build.gradle inside app folder
for example :-
ExampleProject/app/build.gradle <<== in this one
ExampleProject/build.gradle <<== not in this
and it should look like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy' // <<== add this
defaultConfig {
applicationId "com.example.project"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}

Error:Failed to find: com.nineoldandroids:library:2.4.0

I am going to migrate to android studio.
I would like to use this lib :
https://codeload.github.com/flavienlaurent/datetimepicker/zip/master
after this tutorial :
https://www.youtube.com/watch?v=1MyBO9z7ojk
now I get this error :
Error:Failed to find: com.nineoldandroids:library:2.4.0
build.gradle in datetimepicker-library :
apply plugin: 'com.android.library'
repositories {
mavenCentral()
}
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:20.0.0'
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionName rootProject.versionName
versionCode rootProject.versionCode
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
updated
all my error :
Update this
dependencies {
compile 'com.nineoldandroids:library:2.4.0+'
}
Then Gradle your project
it's simple actually, just past
repositories {
mavenCentral()
}
to your build.gradle of the project (not the build.gradle of the module)

Unexpected node Android Packaging in Android Gradle build

I am trying to make my project use gradle. The problem is that everytime I try to build, I get the following error:
Error:Internal error: (java.lang.AssertionError) Unexpected node Android Packaging; nodes=[Module 'Serengeti' production, Resources for 'Serengeti' production, Resources for 'Serengeti' tests, Artifact 'Serengeti', gradle-resources-production:Serengeti, gradle-resources-test:Serengeti, Android Gradle Build Target]
java.lang.AssertionError: Unexpected node Android Packaging; nodes=[Module 'Serengeti' production, Resources for 'Serengeti' production, Resources for 'Serengeti' tests, Artifact 'Serengeti', gradle-resources-production:Serengeti, gradle-resources-test:Serengeti, Android Gradle Build Target]
at com.intellij.util.graph.GraphGenerator.buildOuts(GraphGenerator.java:55)
at com.intellij.util.graph.GraphGenerator.<init>(GraphGenerator.java:36)
at com.intellij.util.graph.GraphGenerator.create(GraphGenerator.java:40)
at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.initializeChunks(BuildTargetIndexImpl.java:86)
at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.getSortedTargetChunks(BuildTargetIndexImpl.java:50)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:610)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:352)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:191)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:131)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:229)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:158)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I have no idea what this means. I found this but it's not really helpful...
This is my build.gradle file. This is my first time using gradle so if there is anything wrong with this please point it out.
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.+'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
// http://gradleplease.appspot.com/
compile 'com.android.support:support-v4:20.+'
compile 'com.google.android.gms:play-services:+'
compile 'joda-time:joda-time:+'
compile 'com.googlecode.android-query:android-query:+'
compile 'me.dm7.barcodescanner:zbar:+'
compile 'com.github.asne.facebook:facebook:3.17.2'
compile('com.twitter.sdk.android:twitter:1.0.1#aar') {
transitive = true;
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
}
lintOptions {
abortOnError false
}
signingConfigs {
SignConfig {
keyAlias 'removed'
keyPassword 'removed'
storeFile file('removed')
storePassword 'removed'
}
}
buildTypes {
debug {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
release {
zipAlignEnabled
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
}
productFlavors {
RunConfig {
signingConfig signingConfigs.SignConfig
}
}
}
How can I fix this error?
Found the solution to this problem. If you go to Project Structure -> Modules -> <Your project> -> Android, you will notice that nothing loads. It will look like this:
In order to fix this, select Android and click Remove (the red dash above). Then click Add (the green plus above) and select Android. Click OK and the error should be gone now.

Gradle Error: Android Studio, ActionbarSherlock, and SlidingMenu

I've been at this for a couple of days trying to get the library structure correct within Android Studio. I would have just continued with Eclipse, but performance wise, it's been really bad for me lately. Please, any guidance would be greatly appreciated as all solutions found have not worked and the documentation has lead me nowhere.
All manifests have an empty application tag except for the main TestProject.
Edit* Prior to including SlidingMenu, I did have ActionBarSherlock working without issues and building, etc.
The Error
Gradle: Execution failed for task ':libraries:SlidingMenu:processReleaseManifest'.
> Manifest merging failed. See console for more info.
Build.Gradle (SlidingMenu)
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile project(':libraries:actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion '17.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aild.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
Build.Gradle (ActionBarSherlock)
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
}
android {
compileSdkVersion 17
buildToolsVersion '17.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aild.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
Build.Gradle (Test Project)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile project(':libraries:actionbarsherlock')
compile project(':libraries:SlidingMenu')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
settings.gradle (Test Project)
include ':TestProject',':libraries:actionbarsherlock',':libraries:SlidingMenu'
For me the problem was with 'missing <application/> tag' in slidingmenu library.
After adding empty <application/> tag to manifest errors disappeared.
Maybe this will help somebody.
See thread here: https://groups.google.com/forum/#!topic/adt-dev/PIah7eYXiNs
Unfortunately, this could be happening for a lot of reasons. I'd suggest running gradle build -info from the command line to see if it gives you more information.
A common merge failure I've run into is when the minSdkVersions are conflicting. I see that your test project minSdkVersion is 7, are the minimum levels declared in the ActionBarSherlock and SlidingMenu manifests 7 or less?
I already solve it. I share my configuration. Maybe this can help you.
Project:
+ TestProject
|-- libraries
|-- ActionBarSherlock
|-- actionbarsherlock
|-- actionbarsherlock-fest
|-- actionbarsherlock-i18n
|-- actionbarsherlock-samples
|-- SlidingMenu
|-- art
|-- example
|-- library
|-- library-maps-support
|-- TestProject
setting.gradle
include ':TestProject', ':libraries:SlidingMenu:library', ':libraries:ActionBarSherlock:actionbarsherlock'
build.gradle (Test Project)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile project(':libraries:ActionBarSherlock:actionbarsherlock')
compile project(':libraries:SlidingMenu:library')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 16
}
}
build.gradle (actionbarsherlock lib)
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
build.gradle (slidingmenu lib)
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile project(':libraries:ActionBarSherlock:actionbarsherlock')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}

Categories

Resources