Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android build system gradle

I am testing androids new build system which still is in beta. I have implemented some code which generates following error:

No such property: resolutionResult for class: org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration

build.gradle

buildscript {
  repositories {
      mavenCentral()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:0.2'
  }
}
apply plugin: 'android'

android {
  sourceSets {
      main {
          manifest {
              srcFile 'AndroidManifest.xml'
          }
          java {
              srcDir 'src'
          }
          res {
              srcDir 'res'
          }
          assets {
              srcDir 'assets'
          }
          resources {
              srcDir 'src'
          }
      }
  }
}

I have tried samples too, which raises the same error. What's wrong?

Gradle Version

------------------------------------------------------------
Gradle 1.3
------------------------------------------------------------

Gradle build time: Dienstag, 20. November 2012 11:37 Uhr UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.6.0_25 (Sun Microsystems Inc. 20.0-b11)
OS: Windows 7 6.1 amd64

Full Gradle Stacktrace

org.gradle.listener.ListenerNotificationException: Failed to notify project evaluation listener.
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:97)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:32)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at $Proxy9.afterEvaluate(Unknown Source)
        at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:47)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:463)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:75)
        at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
        at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
        at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:67)
        at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:96)
        at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:439)
        at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:434)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:32)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:137)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:39)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: groovy.lang.MissingPropertyException: No such property: resolutionResult for class: org.gradle.api.internal.artifacts.ivyservice.ErrorHandingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration
        at com.android.build.gradle.BasePlugin.resolveDependencyForConfig(BasePlugin.groovy:641)
        at com.android.build.gradle.BasePlugin$resolveDependencyForConfig.callCurrent(Unknown Source)
        at com.android.build.gradle.BasePlugin.resolveDependencies(BasePlugin.groovy:584)
        at com.android.build.gradle.BasePlugin$resolveDependencies.callCurrent(Unknown Source)
        at com.android.build.gradle.AppPlugin.createAndroidTasks(AppPlugin.groovy:116)
        at com.android.build.gradle.AppPlugin.this$3$createAndroidTasks(AppPlugin.groovy)
        at com.android.build.gradle.AppPlugin$_apply_closure5.doCall(AppPlugin.groovy:73)
        at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:116)
        at org.gradle.listener.BroadcastDispatch$ClosureInvocationHandler.dispatch(BroadcastDispatch.java:101)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:88)
        ... 33 more

I've tried downgrading to Gradle 1.2. Now i get another exception.

------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------

Gradle build time: Mittwoch, 12. September 2012 10:46 Uhr UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.6.0_25 (Sun Microsystems Inc. 20.0-b11)
OS: Windows 7 6.1 amd64

Stacktrace after downgrading to Gradle 1.2

:prepareReleaseDependencies
:compileReleaseAidl FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseAidl'.
> target cannot be null.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileReleaseAidl'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
        at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
        at org.gradle.cache.internal.DefaultCacheAccess$3.create(DefaultCacheAccess.java:243)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:188)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:241)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137)
        at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
        at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
        at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
        at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:118)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:133)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:116)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
        at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
        at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)
        at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:39)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: java.lang.NullPointerException: target cannot be null.
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208)
        at com.android.builder.AndroidBuilder.setTarget(AndroidBuilder.java:131)
        at com.android.builder.AndroidBuilder$setTarget.call(Unknown Source)
        at com.android.build.gradle.internal.ProductionAppVariant.createBuilder(ProductionAppVariant.groovy:90)
        at com.android.build.gradle.internal.ProductionAppVariant$createBuilder.call(Unknown Source)
        at com.android.build.gradle.BasePlugin.getAndroidBuilder(BasePlugin.groovy:133)
        at com.android.build.gradle.BasePlugin$getAndroidBuilder.call(Unknown Source)
        at com.android.build.gradle.BaseTask.getBuilder(BaseTask.groovy:33)
        at com.android.build.gradle.CompileAidlTask_Decorated.getBuilder(Unknown Source)
        at com.android.build.gradle.CompileAidlTask_Decorated$getBuilder.callCurrent(Unknown Source)
        at com.android.build.gradle.CompileAidlTask.generate(CompileAidlTask.groovy:39)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
        at com.android.build.gradle.CompileAidlTask_Decorated.invokeMethod(Unknown Source)
        at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:161)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:156)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
        ... 58 more
like image 759
endian Avatar asked Dec 10 '12 13:12

endian


People also ask

What is gradle build system?

Gradle is a build system (open source) that is used to automate building, testing, deployment, etc. “build. gradle” are scripts where one can automate the tasks.

What is Android gradle build?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.

What's the build system for Android?

The Android build system is the toolkit you use to build, test, run and package your apps. The build system can run as an integrated tool from the Android Studio menu and independently from the command line. You can use the features of the build system to: Customize, configure, and extend the build process.

Where is build gradle Android?

The app level build. gradle file is located inside your project folder under app/build. gradle.


2 Answers

Version 0.2 was developed with Gradle 1.2 (1.3 wasn't out yet). We know we are using some internal stuff for now, so it's possible it's broken on 1.3 (haven't tested yet, will do it soon).

For now, please use Gradle 1.2

like image 111
Xavier Ducrohet Avatar answered Sep 29 '22 19:09

Xavier Ducrohet


You need to add compliedSdkVersion 17 to your gradle.build file:

Edit: reference project I just created. Builds, signs,etc https://github.com/yegdroid/gradle_demo

//
// A basic Android application that follows all the conventions
//
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.3'
    }
}
apply plugin: 'android'

android {
    testBuildType = "debug"

    defaultConfig {
        versionCode = 1
        versionName = "0.1"
        minSdkVersion = 9
        targetSdkVersion = 17


        compileSdkVersion 17
        buildConfig "private final static boolean DEFAULT = true;", \
                    "private final static String FOO = \"foo\";"
    }

    buildTypes {
        debug {
            packageNameSuffix = ".debug"

            buildConfig "private final static boolean DEBUG2 = false;"
        }
    }

    aaptOptions {
        noCompress "txt"
    }
    sourceSets {
          main {
              manifest {
                  srcFile 'AndroidManifest.xml'
              }
              java {
                  srcDir 'src'
              }
              res {
                  srcDir 'res'
              }
              assets {
                  srcDir 'assets'
              }
              resources {
                  srcDir 'src'
              }
          }
      }
}
like image 36
cbrulak Avatar answered Sep 29 '22 18:09

cbrulak