I'm currently using Android experimental gradle plugin. I need to have multiple custom sub folder in res but when I combine with main java source srcDirs, it will always prompt error message
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe''
finished with non-zero exit value 1
my gradle version is 2.5
What is the proper way to configure android.sources for experimental gradle version
in my app's build.gradle file:
apply plugin: 'com.android.model.application'
...
android.sources {
main {
java {
source {
srcDirs = ["src"]
}
}
res{
source {
srcDirs = [ 'src/main/res/property/search',
'src/main/res/property',
'src/main/res/agent',
'src/main/res'
]
}
}
}
}
Current latest and standard configuration which i uses for build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.xyz"
minSdkVersion 14
targetSdkVersion 23
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:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.mikhaellopez:circularimageview:2.0.2'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile files('libs/picasso-2.0.0.jar')
compile 'com.github.rahatarmanahmed:circularprogressview:2.4.0'
}
I think you need to add model tag before android, like it
apply plugin: 'com.android.model.application'
...
model.android.sources {
main {
java {
source {
srcDir = 'src'
}
}
res {
source {
srcDirs = ['src/main/res/property/search',
'src/main/res/property',
'src/main/res/agent',
'src/main/res'
]
}
}
}
}
Related
com.android.build.api.transform.TransformException :
Error while generating the main dex list.
com.android.tools.r8.errors.CompilationError:
Program type already present: com.xyja.bcclalib.BuildConfig
I have try these ways:
build clean my module
clean project
delete .gradle && build && .idea && [module]build
then rebuild my project
but I can't solved it. Anyone who can help me solve this? Thx.
This is my build.gradle(app).
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.xyja.bcclalib"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories{
flatDir {
dirs 'libs'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation project(':BcClaLibirary')
implementation 'com.android.support:multidex:1.0.3'
}
And this is part of my build.gradle(BcClaLibirary).
apply plugin: 'com.android.library'
android {
...
}
dependencies {
implementation files('libs/bcprov-jdk15on-157.jar')
implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
implementation files('libs/sun.misc.BASE64Decoder.jar')
implementation (name: 'ESecurityLib-release', ext: 'aar')
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
apply from: './nexus_maven.gradle'
Try this:
//app
repositories{
flatDir {
dirs 'libs'
dirs.project(':BcClaLibirary').files('libs')
//or you can use this way
//dirs 'libs', '../BcClaLibirary/libs'
}
}
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\androidWare\jdk1.7\bin\java.exe'' finished with non-zero exit value 1
My app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.wjc.wjcrun"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
}
dependencies {
compile "org.igniterealtime.smack:smack-android:4.1.0-rc1"
compile "org.igniterealtime.smack:smack-tcp:4.1.0-rc1"
}
Here is Project Build Gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Use your build.gradle like this.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.wjc.wjcrun"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile "org.igniterealtime.smack:smack-android:4.1.0-rc1"
compile "org.igniterealtime.smack:smack-tcp:4.1.0-rc1"
}
}
I'm new in NDK .and try to setup Integration with NDk .But after research through many sites ,i could not solved my problem. Here is build.gradle file
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
}
android.ndk {
moduleName "native"
}
defaultConfig.with {
applicationId "app.com.jnitester"
minSdkVersion.apiLevel 15
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
buildConfigFields {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
/* android.ndk {
moduleName = "native"
}*/
android.buildTypes {
release {
minifyEnabled false
proguardFiles += file('proguard-rules.txt')
}
}
android.productFlavors {
create("flavor1") {
applicationId "com.app"
}
}
android.sources {
main {
jni {
source {
srcDir 'src'
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
my classpath is:
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
we get error like that:
Error:(18, 0) No signature of method: org.gradle.model.dsl.internal.NonTransformedModelDslBacking.applicationId() is applicable for argument types: (java.lang.String) values: [app.com.jnitester]
Open File
when i put buildTypes,productFlavours,sources inside android{} then it gives Errors like that:
Error:(4, 1) A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: model.android
> Could not find method compileSdkVersion() for arguments [23] on project ':app'.
may be this question be duplicate but we couldn't find the solution yet .
Your help would save my time. Any Help would be appreciated in Advanced.
try adding '=' char. e.g.
compileSdkVersion 23
change to
compileSdkVersion = 23
I've checked a few different questions, but none of them provided a solution which worked for me. I'm developing a project with Android Annotations, and when I attempt to build my project it fails with the following error (Project_Location is simply my local project folder):
error: Could not find the AndroidManifest.xml file in specified path : [/Project_Location/mobile/build/intermediates/manifests/full/debug/AndroidManifest.xml]
Here is my mobile build.gradle file:
apply plugin: 'com.android.application'
ext.androidAnnotationsVersion = '3.3.2';
ext.eventBusVersion = '2.4.0';
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'android-apt'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
wearApp project(':wear')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
apt "de.greenrobot:eventbus:${eventBusVersion}"
compile "de.greenrobot:eventbus:${eventBusVersion}"
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.dev.app_name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "0.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations {
apt
}
apt {
arguments {
androidManifestFile variant.outputs.processResources.manifestFile
resourcePackageName 'com.dev'
}
}
android.applicationVariants.each { variant ->
aptOutput = file("${project.buildDir}/source/apt_generated/${variant.dirName}")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}
If the build.gradle file looks like a mess, I've tried to implement multiple solutions already without success. So if there's redundant statements that can be removed feel free to provide those suggestions as well. Right now, I'm just stumped as to why it can't locate my manifest file which is clearly present.
I fixed your build script which should be working regarding AndroidAnnotations:
apply plugin: 'com.android.application'
ext.androidAnnotationsVersion = '3.3.2';
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.dev.app_name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "0.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName "com.dev.app_name" // the same as package in the manifest
}
}
Update: to use with annotationProcessor instead of apt:
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": "com.dev.app_name"]
}
}
}
}
And make sure you are using the latest version of AndroidAnnotations.
I have the following build.gradle file :
apply plugin: 'android-library'
apply plugin: 'maven'
android {
compileSdkVersion 19
buildToolsVersion '19.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
}
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
dependencies {
compile project(':olympus-commons')
compile project(':stream-client')
compile project(':door-proxy')
compile 'com.google.guava:guava:17.0'
compile 'to.talk.aragorn:logging:0.1-SNAPSHOT#aar'
compile 'to.talk.aragorn:event-utils:0.1-SNAPSHOT#aar'
compile 'to.talk.aragorn:commons:0.30-SNAPSHOT#aar'
}
def coreAarFile = file('build/conman-client.aar')
artifacts {
archives coreAarFile
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://ci.aws.talk.to:8081/nexus/content/repositories/snapshots",
authentication: [
userName: 'deployer',
password: 'qwedsa'
])
pom.groupId = 'to.talk.legolas'
pom.artifactId = 'conman-client'
pom.version = '1.01-SNAPSHOT'
}
}
}
When i build the module, it builds successfully. But i dont see the conman-client.aar generated. what could be the reason for that?
I read in one of the articles that adding apply plugin: 'android-library' to the build.gradle file will produce the .aar file when the module is built.
But this is not happening. what could be the reason for this ?
Thanks
this is the plugin:
apply plugin: 'com.android.library'
if you add an android library module it will be set automatically and when you build it will create an arr file inside build/outputs/arr