Could not find method compile() for arguments [file collection] on object - android

This image shows the project structure and the error
I'm following this tutorial to build a sample app using Kudan.
Here I got an error (Shown in the screenshot) after step 5 (means after Adding kudanar.jar and cardboard.jar as file dependencies )

I'm not sure I see why you need a new module for cardboard. You can just place the cardboard.jar into app/libs, and in the app/build.gradle, you can compile that JAR file as well as any others with this one line
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

Related

com.mcruiseon.buseeta E/dalvikvm: Unable to resolve Lmy/library/class/file; annotation class 8906

My library project starts like this
#XmlRootElement(name = "GetUserDomainOrGroupMasterResponse")
#XmlAccessorType(XmlAccessType.FIELD)
public class GetUserDomainOrGroupMasterResponse implements Serializable,
I have built a jar, and copied this jar to the libs folder of my android project using android studio.
My gradle file in my android studio project has
compile fileTree(dir: 'libs', include: ['*.jar'])
I also tried adding
compile files('libs/mylibrary.jar')
When I open the jar archive the class file is RIGHT THERE
Now, when I run my project I get a
com.myapp.package E/dalvikvm: Unable to resolve Lmy/library/class/file; annotation class 8906
I have tried
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/mylibrary.jar')
compile files('libs/mylibrary.jar')
3.
compile fileTree(dir: 'libs', include: ['*.jar'])
I have also tried building a executable jar for my jar file and still I get the damn Error
I dont get it. What am I missing here ?
Edit
I noticed that the app does not have any side effect due to this Error. In any case its a irritant. Please help me resolve this.
#XmlRootElement annotation has retention RUNTIME in jaxb-api. This annotation should be available in runtime as normal classes (https://en.wikipedia.org/wiki/Java_annotation).
Since your library compiled against jaxb it has a notion of this annotation, but it is not included and can not be found in runtime.
As a solution, you could add jaxb as compile dependency to your app (several Mb plus) or add just this annotation definition to your android project.

Gradle doesn't find acra

I have an Android project in which I have been using ACRA 4.6.0 with a static jar file, all working fine. I have tried to change this to use the latest ACRA by the maven dependency in build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
compile 'ch.acra:acra:4.8.5'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
in my build.gradle. However this causes the build to fail with errors like:
CJApp.java:13: error: cannot find symbol
import org.acra.ACRAConfiguration;
^
symbol: class ACRAConfiguration
location: package org.acra
So far as I can tell gradle is not downloading anything for acra. I have tried adding mavenCentral() to the repositories list with no effect.
What else do I need to do, and is there any way of determining just what gradle has downloaded?
Are you sure that the class org.acra.ACRAConfiguration is included in the new version: acra:4.8.5 which you're suddenly linking to? If not, this is a simple matter of incompatibility. In that case, it should be resolved if you step the version back to 4.6.0.
Have you checked that the build downloads the file from Maven Central? This should be clearly visible when giving gradle the -i flag - it will print every URL as it downloads them.
ACRAConfiguration has moved to org.acra.config. Just adjust your import.

simple login application with parse.jar gives 'java.lang.NoClassDefFoundError: com.parse.ParseUser'

I am working on a simple login android application in android studio with parse. Just a few backs I switched in to studioo from ecclipse so I am not much familier with that. I am refering the following tutorial.parse tutorial
I have done everything as they mentioned. Added parse.jar[add in to libs folder and settings file updated ] and update app gradile file.
But when I tried to run the application , it crashes.java.lang.NoClassDefFoundError: com.parse.ParseUser.
If anybody have any idea about my issue please help me to solve it. I didn't find any similar questions thats why posting.
My app gradile file have below lines.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
} and we can't add dependencies to outer [main] gradile file..right?...there is
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Have you added a compile command to your build.gradle file?
For example:
compile fileTree(dir: 'libs', include: ['*.jar'])

Android Studio - MavenCentral dependency sync ok, but symbol cannot be resolved

So, I managed to create an Android library component and publish it on Maven Central. But when I'm trying to use it as a dependency in a new project, Android Studio can't seem to find the classes.
build.gradle for the app module:
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'no.hyper:libdateintervalpicker:1.0.0' //this is the one I want to use
}
This part seems to work, at least I get no sync errors. However, when trying to access to package and classes from my MainActivity, Android Studio can't find them and gives me "cannot resolve symbol" message.
I have tried downloading the classes.jar from the archive directly from Maven Central, and they are indeed in the package.
Other dependencies seem to appear in the /build/intermediates/exploded-aar folder after syncing, but that does not happen to my library.
I use Android Studio 1.0.2 on OSX 10.9.5 (Mavericks)
Any suggestions?
Looking in your pom, it states <packaging>aar.asc</packaging>. It should be aar instead.
Oh, and the answer to actually being able to use the library, was to add #aar to the dependency so that it now reads
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'no.hyper:libdateintervalpicker:1.0.0#aar' //note the magic #aar
}
Edit:
Removing the block
configurations {
archives {
extendsFrom configurations.default
}
}
makes Gradle generate the pom with the correct packaging entry, and thus makes it possible to reference the dependency without the #aar suffix

How to avoid use dependencies again (Android)?

I've created an Android library with Studio and this library needs some 3rd libraries. The build.gradle looks like below:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
The library can be compiled freely and finely, and then I push them in to local Maven. Everything fine!
Now I create a client application just for a sample of my library. What confusion is that I must do follow:
dependencies {
compile fileTree(dir: 'libs', include: ['*.*'])
compile 'mylibrary:1.0'
compile 'some library:1.3.2'
compile 'some other library:1.3.4'
}
Which means to include the two 3rd libraries. Otherwise I must get errors "NoClassFound" which relevant to the two libraries.
You know the
compile 'mylibrary:1.0'
is the meaning to include my library, but why should I include the other twos which were used by "mylibrary"? Could I avoid that and just -compile 'mylibrary:1.0' ?
OK, I've solved project with the help of #CommonsWare
Check out
http://www.gradle.org/docs/current/userguide/publishing_maven.html
http://maven.apache.org/pom.html
To make a pom.xml self and done.

Categories

Resources