Android app ActionBarSherlock integration error - android

I have been following this tutorial for integrating ActionBarSherlock in the Android Studio IDE.
After following all the steps I get the following error:
Gradle: A problem occurred evaluating project ':MyApp'.
> Could not find property ':actionbarsherlock' on DefaultProjectDependency{dependencyProject='project ':MyApp'', configuration='default'}.
The source of the error is my AndroidStudioProjects\MyApp\myapp\build.gradle file with the contents as follows:
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 'com.google.code.gson:gson:2.2.+'
compile project ':actionbarsherlock'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}

Maybe a late answer, but try like that :
compile project(':actionbarsherlock')

Related

Error:Circular reference between projects

I am importing a Eclipse Project to Android Studio. But it occur error like below. How do resolve this type of error
Error:Circular reference between projects: :app -> :app
below is settings.gradle file
include ':app'
here is build.gradle file
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
buildToolsVersion "23.0.1"
compileSdkVersion 23
defaultConfig {
targetSdkVersion 22
}
productFlavors {
}
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
Sol1:same name(:app) will not add in Android Studio.
sol2:if the :app name is not there in your Project,
Create new Project and import again, it will work
sol3:in settings.gradle file
include ':app',':core'
add like this.

Android application with Android library project as external module

In my Android application project I want to use https://github.com/Bearded-Hen/Android-Bootstrap/tree/master/AndroidBootstrap as a dependency (I use Android Studio 0.8.8).
This is my settings.gradle
include ':gui', ':client', ':Android-Bootstrap'
project(':Android-Bootstrap').projectDir=new File('/abs/path/to/Android-Bootstrap/AndroidBootstrap')
And my gui/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
}
...
skipped
...
}
dependencies {
...skipped...
compile 'com.android.support:appcompat-v7:19.1.0'
...skipped...
compile project(':client')
compile project(':AndroidBootstrap')
}
When I gradle sync I get::
Error:(1, 0) Plugin with id 'android-library' not found.
If I remove
project(':Android-Bootstrap').projectDir=new File('/abs/path/to/Android-Bootstrap/AndroidBootstrap')
I get
Error:(44, 0) Project with path ':AndroidBootstrap' could not be found in project ':gui'.
If I change https://github.com/Bearded-Hen/Android-Bootstrap/blob/master/AndroidBootstrap/build.gradle with
apply plugin: 'com.android.library'
I get
Error:(1, 0) Plugin with id 'com.android.library' not found.
If I add to https://github.com/Bearded-Hen/Android-Bootstrap/blob/master/AndroidBootstrap/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
}
}
I get
Error:(44, 0) Project with path ':AndroidBootstrap' could not be found in project ':gui'.
How to fix it? I want this module be external, no import and copying into main project. Why fixing gradle plugin dependency leads to path not found issue?
Fix as follows in settings.gradle:
include ':gui', ':client', ':AndroidBootstrap'
project(':AndroidBootstrap').projectDir=new File('/abs/path/to/Android-Bootstrap/AndroidBootstrap')
Note that Android-Bootstrap is replaced with AndroidBootstrap (not dash)
And in root build.gradle (./build.gradle)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
}
}
It will override (set) buildscript dependencies in AndroidBootstrap.
There is not need to make changes in AndroidBootstrap itself.

What is the correct way to specify an Android library project to include its dependencies

In Android Studio I'm trying to compile an Android application module which uses an Android library.
The library includes a jar file for Bugsense (included automatically by gradle).
Although the library module compiles correctly, the application module fails because it is looking for the Bugsense jar file that is used within the library module.
I do have a workaround which allows the project to compile. By also including the Bugsense dependency in the project everything works.
My question is: How do I make the project compile without duplicating the Bugsense dependency?
Here is my build.gradle file for the library project.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
maven { url 'http://www.bugsense.com/gradle/' }
}
android {
compileSdkVersion 15
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
}
}
dependencies {
compile 'com.bugsense.trace:bugsense:3.6'
}
The library project is called "util"
Following is the android section of the build.gradle for the application
android {
compileSdkVersion 15
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
}
dependencies {
compile project(':util')
}
}
When I compile this I get the following error:
* What went wrong:
A problem occurred configuring project ':br'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':br:_DebugCompile'.
> Could not find com.bugsense.trace:bugsense:3.6.
Required by:
dss:br:unspecified > dss:util:unspecified
I can make the compile work by adding Bugsense to the repositories section of the build.gradle file for the application. Following is the code I added to the build.gradle file for the application project.
repositories {
mavenCentral()
maven { url 'http://www.bugsense.com/gradle/' }
}
Remember, the above code is in the build.gradle for the application project AND the library.
How do I avoid adding the Bugsense dependency to both the application and library projects?
UPDATES:
I'm using Gradle 1.8
I'm compiling from the command line with "gradle clean assembleDebug"
The following is the complete build.gradle file for the application project:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
//maven { url 'http://www.bugsense.com/gradle/' }
}
android {
compileSdkVersion 15
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
testPackageName "com.myapp.test"
}
dependencies {
compile project(':common')
compile project(':util')
}
}
dependencies {
instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.3'
instrumentTestCompile 'com.squareup:fest-android:1.0.+'
instrumentTestCompile 'com.squareup.spoon:spoon-client:1.0.+'
instrumentTestCompile 'com.google.guava:guava:15.0'
}
configurations { spoon }
dependencies { spoon 'com.squareup.spoon:spoon-runner:1.0.5' }
It's the expected behavior. Only the repository declarations for the project whose configuration is currently resolved are taken into account, even when transitive dependencies are involved. Typically, repositories are declared inside the root project's allprojects { .. } or subprojects { ... } block, in which case this problem can never occur.
PS: dependencies { .. } needs to go outside the android { ... } block.

Updating Android Studio to 0.3.5 .Project doesnt work ClassNotFoundException

I have two projects. DataModel and my application.
My application starts successfully but then fails with classnotfoundexception. Cant find DataModel project.I used to have the same problem before but I could fix it by updating gradle files although randomly android studio would screw them
DataModel build.gradle
apply plugin: 'java'
MyApplication build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:gridlayout-v7:18.0.0'
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.squareup.okhttp:okhttp:1.2.1'
compile 'com.squareup.retrofit:retrofit:1.2.2'
compile project(':DataModel')
}
MyApplication settings.gradle
include ':MyApplication ', ':DataModel'
Have you tried to clean the project? Build--> Clean
There is actually a known issue about something like that, maybe it's enough if you update to 0.3.6.
https://code.google.com/p/android/issues/detail?id=62011

Android studio gives error when i add dependencies to build.gradle

I am trying to add AdMob sdk to my android project using Android SDK.
Here is what is did.
i added admob jar file to the lib folder.
added as module
then added dependencies to my build.gradle.
Below is the build.gradle file looks as
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.+'
}
dependencies{
compile files('libs/android-support-v4.jar','libs/GoogleAdMobAdsSdk-6.4.1')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
Below is the error.
Gradle 'StoriesIndian' project refresh failed:
Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Build file 'C:\Users\lokesh\Desktop\MyStoryProject\StoriesIndianProject\StoriesIndian\build.gradle' line: 11
A problem occurred evaluating project ':StoriesIndian'.
A problem occurred evaluating project ':StoriesIndian'.
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection) values: [file collection]
Possible solutions: module(java.lang.Object
)
Please help, what do to make it work and where to include module java.lang.object.
thanks

Categories

Resources