Menu
  • HOME
  • TAGS

Gradle build error with Simpleframework

Tag: gradle,dependencies,android-gradle,build.gradle,simple-framework

I upload my library module to jcenter and I use this module with my application project.

I try to build my application it returns an error.

I searched this issue and This issue is due to be aware of what simpleframework.

I have to use this library both My library module and application module.

How can I solve this problem?

Gradle error msg is below

trouble processing "javax/xml/stream/events/StartElement.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation. 1 error; aborting Error:Execution failed for task ':app:preDexDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\jdk1.7.0\bin\java.exe'' finished with non-zero exit value 1

My library build.gradle dependencies are below.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile ('org.simpleframework:simple-xml:2.7.+') {
        exclude module: 'stax'
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }
}

My Application dependencies are below :

dependencies {
    compile 'com.android.support:support-v4:19.+'
    compile 'com.google.android.gms:play-services:5.+'
    compile 'com.jakewharton:butterknife:5.1.2'
    compile 'com.jakewharton.timber:timber:3.1.0'
    compile 'commons-io:commons-io:2.4'
    compile 'commons-net:commons-net:3.3'
    compile 'org.apache.httpcomponents:httpmime:4.2.5'
    /*compile 'com.mcxiaoke.volley:library:1.0.+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile('org.simpleframework:simple-xml:2.7.+') {
        exclude module: 'stax'
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }*/
    compile 'org.jsoup:jsoup:1.7.2+'
    compile 'com.effectivelife:cokcok-support:1.0.0'
}

Best How To :

I solved this problem.

I add a configurations to my application project.

So my application build.gradle file is below.

configurations {
    compile.exclude module: 'stax'
    compile.exclude module: 'stax-api'
    compile.exclude module: 'xpp3'
}

dependencies {
    compile 'com.android.support:support-v4:19.+'
    compile 'com.google.android.gms:play-services:5.+'
    compile 'com.jakewharton:butterknife:5.1.2'
    compile 'com.jakewharton.timber:timber:3.1.0'
    compile 'commons-io:commons-io:2.4'
    compile 'commons-net:commons-net:3.3'
    compile 'org.apache.httpcomponents:httpmime:4.2.5'
    compile 'org.jsoup:jsoup:1.7.2+'
    compile 'com.effectivelife:cokcok-support:1.0.1'
}

Using ant.replace in gradle

replace,ant,gradle

It should be: task writeVersion << { ant.replace( file: 'version.txt', token: 'versionNumber', value: '1.0.0' ) } and: version.number=versionNumber ...

The method is undefined for the type [Class Name]

java,maven,dependencies,maven-plugin

You have to build project A then project B. You also have to use the -U flag in Maven: $ mvn clean install // in A $ mvn clean install -U // in B to force update of snapshots ...

scala minecraft forgemod 'gradle runClient' gives runtime exception

scala,gradle,akka,minecraft,minecraft-forge

I figured it out. application.conf had: provider = "akka.cluster.ClusterActorRefProvider" cluster isn't part of akka-actor its part of akka-cluster. I've switched to provider = "akka.actor.LocalActorRefProvider" That works now. The other option is to add akka-cluster to the dependancies list. If your actually trying to use ClusterActorRefProvider...

Django migrations missing way to declare “needed_by”?

django,dependencies,database-migration,django-south

You should use the run_before attribute: class Migration(migrations.Migration): run_before = [ ('core_app', '0001_initial'), ] ...

Breaking cyclic dependency in constructor

java,dependency-injection,dependencies,circular-dependency,decoupling

Use setter for passing GameMap into Cell not constructor. You can make it package-protected to hide it from other code and call setter in GameMap constructor or in another loop in GameMapBuilder. All known DE-frameworks use setters to solve circular dependencies.

Gradle Jar structure is different than the real project structure

java,jar,gradle,build

When your project is managed by gradle you should always use standard layout introduced by maven or have a good excuse to using any different layout. Here you can find sample project that shows how to use the this layout and read the resources that will be later included in...

Choosing specific ports on local development server for non-default modules

java,google-app-engine,android-studio,gradle,app-engine-modules

@crazystick answered it for Maven. Here's the same solution re-done for Gradle: apply plugin: ear ... appengine { downloadSdk = true httpAddress = "0.0.0.0" jvmFlags = ['-Dcom.google.appengine.devappserver_module.default.port=8080', '-Dcom.google.appengine.devappserver_module.module1.port=8081'] appcfg { email = "[email protected]" oauth2 = true } } ...

How to exclude dependencies of other subproject in Gradle build?

java,eclipse,gradle,dependencies,dependency-management

You could exclude all transitive dependencies of a dependency: compile('groupId:artifactId:version') { transitive = false } Or you could, but I do certainly not recommend this exclude every dependency by hand like this: compile('groupId:artifactId:version') { exclude module: 'groupId:artifactId:version' ... } ...

Can't use RecyclerView in my Android library project

android,gradle,dependencies,recyclerview,android-library

Rebuilt the project and clean it

Exclude Package From Gradle Dependency

java,web-services,rest,gradle

I found out that com.sun.jersey:jersey-core:1.19 doesn't bundle the javax.ws.rs class files and instead lists them as a compile-time dependency. Adding this snippet to my build.gradle fixed the issue. configurations.all { resolutionStrategy { // For a version that doesn't package javax.ws force 'com.sun.jersey:jersey-core:1.19' } } ...

Assembly Dependencies Change After Installation

.net,visual-studio,dependencies,installer,.net-assembly

Ok, figured it out. First, facepalm The assembly added via NuGet has a specific version dependency on Castle.Core 3.2.0. However, because that assembly can still work with Castle.Core 3.2.0-4.0.0, an assembly binding redirect got added to App.config that indicates to the assembly loader that any assemblies requiring a version in...

Add project on outer level as dependency to module

android,intellij-idea,gradle

Add dependencies in the 'build.gradle' of your MainProject, like this: compile project(':proj1') compile project(':proj2') EDIT: And in the 'settings.gradle' this: include ':proj1' project(':proj1').projectDir = new File('../proj1') include ':proj2' project(':proj2').projectDir = new File('../proj2') ...

Gradle Assemble Debug is Successful But Does Not Work [duplicate]

android,command-line,gradle

Look for build outputs under the app module. app/build/outputs/...

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

android,android-studio,gradle,multidex

Try adding dexOptions{ incremental true javaMaxHeapSize "4g" } ...

Paid and Free versions of android app

android,gradle,android-version

You could have two versions of the application in Play store. However, you would have to maintain these separately and it is frustrating to upgrade from free to paid with this approach. If you chose this way of maintaining your application, you would have to have two projects, one for...

Android Studio work with module

java,android,android-studio,gradle

You need to check all Manifest files and ensure your modules are not providing activity with <intent-filter> used by Lauchers: <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> Also ensure your module's build.gradle for module is lists apply plugin: 'com.android.library' (as it should), and not apply plugin: 'com.android.application' (which is not correct)...

gradle execute task after build

gradle,build.gradle

What you need is finalizedBy, see the following script: apply plugin: 'java' task finalize << { println('finally!') } build.finalizedBy(finalize) Here are the docs....

Is it possible to exclude specific build variant when using flavor Dimensions?

android,gradle

Since Gradle 0.9 you can apply a variant filter and iterate over them: productFlavors { freeapp { dimension "version" } x86 { dimension "abi" } paidapp { dimension "mips" } } // Loop variants android.variantFilter { variant -> // Loop flavors variant.getFlavors().each { flavor -> println variant.buildType.name + " "...

Switching branches in Git with external dependencies

git,maven,dependencies,git-branch

It actually depends on an IDE you're using. I haven't noticed any issue with this when using IntelliJ IDEA. It handles any pom.xml changes on the filesystem level very smoothly. However, some time ago, when I was using Eclipse, I believe I saw such a problem you're talking about. Then...

Install gradle on Centos

jenkins,gradle

... but when I unzipped I got gradle.bat file inside bin directory which tells me that this is for Windows. It also contains a file called gradle, which is a shell script. Your download is also suitable for running on any Linux or UNIX platform .... including CentOS....

what is gradle missing to map hibernate?

java,hibernate,gradle

I think the problem is not really with gradle. It's with the fact that the JPA spec stupidly requires that the classes of the entities are in the same jar/directory as the persistence.xml file. And since Gradle doesn't store the "compiled" resources in the same output directory as the compiled...

Android studio gradle flavor dimensions build varients not working correctly

android-studio,gradle,android-gradle,build.gradle,android-productflavors

I think you misunderstood the concept of flavorDimension. A flavorDimension is something like a flavor category and every combination of a flavor from each dimension will produce a variant. In your case, you must define one flavorDimension named "type" and another dimension named "organization". It will produce, for each flavor...

How to use Library from GitHub in android App

android,github,gradle,libraries

You have add path to your aFileDialog library in your settings.gradle Make sure that folder you point to includes build.gradle file include ':app' include ':aFileDialog' project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog') or (judging from the library folder structure on GitHub) project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library') ...

Gradle multi-project custom build.gradle file name

gradle,build,multi-project

A simple web search for "gradle rename build.gradle" renders the below example settings.gradle file: rootProject.buildFileName = 'epub-organizer.gradle' rootProject.children.each { project -> String fileBaseName = project.name.replaceAll("\p{Upper}") { "-${it.toLowerCase()}" } project.buildFileName = "${fileBaseName}.gradle" } Note that the author is here also renaming the root project's build script, which you may or may...

How to create different build variants pointing to different Servers?

android,gradle

It is really easy to do with gradle. productFlavors { first_server { buildConfigField "String", "SERVER_URL", "\"https://first_server_url/\"" } second_server { buildConfigField "String", "SERVER_URL", "\"https://second_server_url/\"" } } You may want to find more information here. So later you can easy access this variable by BuildConfig.SERVER_URL...

How to import directory of .scala files in sbt (unmanaged)?

scala,import,dependencies,sbt

as written in the manual, you can customize the sources (or source directories) pretty freely. by default, sbt will expect to have scala and java sources under a source directory. you can customize that too. depending on your exact use case, maybe you want these sources under a different configuration?...

Gradle - Error:Failed to find: com.squareup.okhttp:okhttp:2.4.0

android,android-studio,gradle,okhttp

You need to add the following block to the build script: repositories { mavenCentral() } ...

duplicate an android studio project

android,gradle,duplicates,project,sync

i think that i found the source of my problem it was a virtual machine problem. so the solution is : open file -> settings clic to : compiler in the VM option field put te following value: -Xmx512m That's all...

Spring Boot Actuator Info Endpoint Version from Gradle File

gradle,spring-boot

This exact use case is spelled out in the Boot docs: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-application-info-automatic-expansion-gradle So in your build.gradle do this version = '0.0.1-SNAPSHOT' processResources { expand(project.properties) } Your application.yml info: build: version: ${version} Make sure to escape any spring placeholders so it doesn't conflict with Gradle. Both use ${} as the replacement...

Roboblender use annotation databases with multiple modules

android,gradle,dependency-injection,roboguice,roboblender

After some hours I found the problem. It was proguard. Adding the following line fixed the issue. -keep public class * extends com.google.inject.AnnotationDatabase You can check that the classes are being generated by running in the project folder: find . | grep -i AnnotationDatabaseImpl ...

Automatically copy .so files from NDK library project?

android-studio,gradle,android-ndk

I does not know if ther is a way to have you .so files copied as you want whiout wirtting anything. But you could have gradle doing it for you. In your gradle file, add a task that copy those .so files where you need them to be. android {...

Set variable to Gadle build file

gradle

That's because the line versionNameSuffix " branch: " + "$branch" is executed during the configuration phase, when all the tasks are configured. Then, when this phase is done and gradle knows all the tasks and their dependencies, setArgs is executed, and the following line is executed: branch = "$word1" You...

Android build project error trying to build apps > 65K (65536) methods

android,android-studio,gradle,build,android-gradle

You need to reduce the size or include only the imports you need to for your application. You are hitting the dex limit of 65536 methods. Here's the link Building Apps with Over 65K Methods which might help....

Android Studio Best way import module from other repository

android,git,gradle,repository

I'd advice to use Jitpack Jitpack: Easy to use package repository for GitHub, just include it inside your gradle, and now you can deal with github project as a module Thanks Jitpack <3 For example: we have this repository: https://github.com/florent37/MaterialViewPager and with Jitpack in your gradle: repositories { maven {...

Visualizing gradle dependencies in Intellij

intellij-idea,gradle,intellij-14

I did a small search in IDEA and Google and looks like there is not way to see Gradle dependency but I have found the plugin "Gradle View" which does what you need http://plugins.jetbrains.com/plugin/7150 You can open a ticket and maybe they will add a better Gradle support in IDEA...

Issue building project on Android Studio - support-v4

android,gradle,android-gradle,build.gradle

Alrighty the solution was to update gradle on build.gradle of my project, not module // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } allprojects { repositories { jcenter() } } it was set...

Creating and referencing a library for Android project (using command line and gradle)

java,android,linux,opencv,gradle

I was finally able to create a library and use it in my Android project! The following links were helpful: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Dependencies-Android-Libraries-and-Multi-project-setup https://docs.gradle.org/current/userguide/multi_project_builds.html http://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/ This whole process made me understand why most people just use Ecipse or Adnroid Studio. But if anyone else wants to try this, I will...

Duplicate entry for class in gradle

java,android,android-studio,gradle

The above library is already on maven. Just remove the imported folder and add the code below to your dependencies: compile 'com.flaviofaria:kenburnsview:1.0.6' Sometimes due to downloading issues; the library fails to download. In that case ; just find your .gradle folder and clear cache inside it. Recompile and you are...

Gradle & Jacoco: Get jacoco reports for Test-type task other than “test”

java,gradle,jacoco

Turns out, this works: task integTestReport (type: JacocoReport) { executionData project.tasks.integTest sourceDirectories = project.files(project.sourceSets.test.allSource.srcDirs) classDirectories = project.sourceSets.test.output def reportDir = project.reporting.file("jacoco/integTest/html") reports { html.destination = reportDir } doLast { println "See report at: file://${reportDir.toURI().path}index.html" } } I hope this is helpful :) EDIT: This needs to be later in the...

Gradle Exec : Why it is not running in configuration phase?

gradle,exec,mkdir

Please have a look at AbstractExecTask from which Exec inherits. As you can see there are lots of getters and setters. What happens at configuration time is setting the values for that fields only, not running them. All the properties set will be used in only when exec() method annotated...

android studio “Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly”

android-studio,gradle,android-gradle

Have you had the project compile / work before? If so the issue is most likely your XML files having issues. Also try to make clean and make sure all of your dependencies are correct if you imported any. You haven't given much info besides the error code about your...

Android Studio and gradle

android,android-studio,gradle

So I have found the solution at this http://www.alonsoruibal.com/my-gradle-tips-and-tricks/. The trick is in your Java Library module's build.gradle file you need to include the following. apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6 Wrong Java Compiler When Including a Java Module as Dependency in Android Studio...

Gradle : Cannot add task ‘:helloFromBuild1′ as a task with that name already exists

gradle

Task name collision may result from improperly importing files. For a better explanation see here.

Deploy closed source aar maven repo to github

android,git,maven,github,gradle

use the raw link, try changing blob for raw: http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html...

Gradle: Adding sources.jar file within /lib folder of published dist.zip along with all my other dependencies

java,maven,jar,gradle

You need to tell the application plugin to include the output of your sourcesJar task in the distribution: distributions { main { contents { from sourcesJar } } } That will place it in the root, if you want it somewhere else you can do this: distributions { main {...

Phonegap: Command failed with exit code 8

android,cordova,gradle

I have already managed to solve this problem, so, in case of anyone has a similar trouble, here it goes the situation I've gone through. When I performed the first build, phonegap attempted to download and extract it's own gradle distribution, and he was attempting to download it from the...

How to download a library dependence on gradle for external use?

cordova,android-studio,gradle,android-gradle,cordova-plugins

What you're looking for is an aar file. You can copy this file to lib folder with the following script: apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'io.filepicker:filepicker-android:[email protected]' } task copyLibs(type: Copy) { from configurations.compile into 'lib' } ...

Adding Android AppWidget just for one Product Flavor

android,gradle,android-appwidget,android-productflavors

So we will have our example packages is as follows for your production and staging builds within the gradle product flavors. productFlavors { production { packageName "x(path).x(path).gradleexample" } staging { packageName "x(path).x(path).gradleexample.staging" } } Here is an example of your folder structure some of which may or may not apply...