Error: package com.google.android.gms.appstate does not exist - android

Can't compile my android project because of this error.
/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java
Error:(32, 39) error: package com.google.android.gms.appstate does not exist
Error:(293, 28) error: cannot find symbol variable AppStateManager
Error:(294, 30) error: cannot find symbol variable AppStateManager
Error:Execution failed for task ':BaseGameUtils:compileReleaseJava'.
Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
My gradle..
apply plugin:
'android-library' repositories
{
mavenCentral()
}
buildscript
{
repositories
{
mavenCentral()
}
dependencies
{
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
dependencies
{
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:+'
}
android
{
compileSdkVersion 21
buildToolsVersion '21.0.0'
defaultConfig
{
minSdkVersion 14
targetSdkVersion 23
}
productFlavors { }
}

I see that you have not specified the goggle play services library.
Instead of this
compile 'com.google.android.gms:play-services:+'
Try this
compile 'com.google.android.gms:play-services:7.8.0'
Note: You might have a different version so instead of 7.8 enter that.

Bump, in my case I was using too high version:
compile "com.google.android.gms:play-services:10.2.1"
I changed it to:
compile "com.google.android.gms:play-services:7.+"
It worked but I have no idea why isn't appstate included in versions above 7

Firstly you should check that /extras/google/google_play_services/libproject/google-play-services_lib> is exist.
Secondly you add code in build.gradle
compile 'com.google.android.gms:play-services:5.+'

You are missing the com.google.android.gms.appstate package. you should add this to your app. for that add compile 'com.google.android.gms:play-services:5.+' to your build.gradle(Module:app).

Related

google play service error

I got this below error
Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in C:\Users\TARUN\Desktop\GingerBuds\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip
Then I changed the above gradle path, Then following problem occurred,
I am getting this exception, while building my project . I rebuild and clean the project and updated google-play-services , then also i got error. can anyone please help me how to solve this.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\TARUN\Desktop\Gingerbuds\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.kitchenvilla.gingerbuds"
minSdkVersion 15
targetSdkVersion 23
versionCode 24
versionName "1.2.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
android {
publishNonDefault true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}
This bug has been fixed according to Google dev blog: http://tools.android.com/tech-docs/new-build-system
2.0.0-alpha6 (2016/1/15)
Instant Run
Fix alpha5 reported issues :
- cannot build when importing play-services.
You should update android gradle tools version
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
}
This exception is thrown during a failed attempt to open the file denoted by a specified Path-name.
You can use
compile 'com.google.android.gms:play-services:8.3.0'
Update your classpath
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
this will solve it
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha2'
}
and
compile 'com.google.android.gms:play-services:8.3.0'
update gradle version to alpha9 in project level gradle file
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
i tried to import admob ads to a new app i was making and i ran into this problem...... i found the solution the be the StartAppInApp file being located in the wrong spot or not being there..... my app needed the StartAppInApp-3.1.1.jar file to be located in the libs folder and when i looked at my app there was no libs folder located there at all .....
open your main app folder... then click app and you should have 3 folders.... src ... build.... and libs .....
in my case there was no libs folder..... so i created the libs folder and then went and copied the StartAppInApp-3.1.1.jar file from a different android project i had and i pasted it to the new libs folder i made in my current project... the error is now GONE!
i also made sure to include
compile files('libs/StartAppInApp-3.1.1.jar')
in the dependencies of my app gradle file
not sure if this is a solid answer but if anyone has this problem double check your StartAppInApp-3.1.1.jar location and version and check your gradle dependencies

How can I add a JAR in my gradle project?

I am using gradle in Android studio for an android project. I have a jar that I downloaded called TestFlightAppLib.jar. This jar isn't present in the maven repository so I can't just put it in my build.gradle.
How can I add this JAR file to my project? I don't see any option to add an external jar to the project.
Update
This is my complete 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 8
targetSdkVersion 18
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.squareup.retrofit:retrofit:1.2.2'
compile 'com.github.rtyley:roboguice-sherlock:1.5'
compile 'org.roboguice:roboguice:2.0'
compile files('libs/TestFlightLib.jar')
}
This is the error message:
Gradle: Execution failed for task ':MyProject:compileDebug'.
> Compilation failed; see the compiler error output for details.
/Users/droid/android/MyProjectProject/MyProject/src/main/java/com/mypkg/ui/activity/MainApplication.java
Gradle: error: package com.testflightapp.lib does not exist
Here is the class:
import com.testflightapp.lib.TestFlight;
public class MainApplication {
}
just add
compile fileTree(dir: 'libs', include: '*.jar')
to your dependencies in the build.gradle then all the jars in the libs folder will be included.
Put the jar in a folder called libs (created on the root of your project). Once moved right click on the jar and you will find "add as library". Click on it and select the module!

Error adding dependency to project

I'm trying to add a library as a dependency but it keeps giving me this error:
Class android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat.AccessibilityServiceInfoIcsImpl
has already been added to output. Please remove duplicate copies.
Execution failed for task ':BrooklynTech:dexDebug'.
Could not call IncrementalTask.taskAction() on task ':BrooklynTech:dexDebug'
Here is my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
dependencies {
compile files('libs/Simple-Rss2-Android.jar')
compile 'org.jsoup:jsoup:1.7.3'
compile 'uk.co.androidalliance:edgeeffectoverride:1.0.1'
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile project(':libraries:calendar-card')
compile 'com.twotoasters.jazzylistview:library:1.0.0' }
the dependency I added was for jazzylistview - https://github.com/twotoasters/JazzyListView
How can I fix the error?
More than one of your dependencies is including the classes from the v4 support library; you'll need to track it down. You ought to be able to open up the jar files from the project viewer and find the culprit.
Ideally none of your dependencies ought to be bundling the support library; it's the responsibility of your app's build to make sure that gets finally linked in.
Not sure, but could you try the following snippet. Maybe the transitive libs are causing the trouble
dependencies{
...
compile ('com.twotoasters.jazzylistview:library:1.0.0'){
transitive = false
}
}
cheers,
René

Android app ActionBarSherlock integration error

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')

Gradle error "Attribute "xxx" has already been defined" in Android Studio

I created a project in Android Studio and added a few dependencies using Maven Central and when I try to compile, I run into this type of errors:
Error:Gradle: Attribute "titleTextStyle" has already been defined
Error:Gradle: Attribute "subtitleTextStyle" has already been defined
[...]
And so on... Here is my build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
}
}
dependencies {
// Support Libraries
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:support-v13:18.0.0'
// Third-Party Librairies
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'ch.acra:acra:4.5.0'
}
Sadly the Make Console doesn't speak as much as Eclipse's Console, so I have no idea of the problem's origin.
Does anyone have an idea of what causes these compile errors?
You should remove this line in your dependencies :
compile 'com.android.support:appcompat-v7:18.0.0'
The last version of Google Play Services now uses appcompat-v7, so u can't use it with actionbarsherlock. You have to use only appcompat-v7 or the previous version of play services:
compile 'com.google.android.gms:play-services:7.0.0'

Categories

Resources