failed to resolve 'com.google.android.gms.play-services:+7' - android

for the first time I am using google maps in my android studio project I have added the dependency in my project but i ma geeting error
Here is all the code from build.gradle(project:Location) file of my project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
here is the all the code from build.gradle(Module.app) file of my project
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.anonymous.location"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.google.android.gms.play-services:+7'
testCompile 'junit:junit:4.12'
}
Here is the all code from my AndroidMenifest.xml file of my project
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.anonymous.location">
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/
google_play_services_version"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

compile 'com.google.android.gms.play-services:+7'
it should be-
compile 'com.google.android.gms:play-services:7+'
but you should avoid inexact versions, use more specific like "9.4.0" or whatever suits your application.
https://developers.google.com/android/guides/releases check here for the versions. check what functionality you want and use that version code. Also note the different variant of play-services are available.

Like Arnav said, you have to use -
compile 'com.google.android.gms:play-services:7+'
Adding to that, if you want to check the latest dependency for any library,
use this - Check latest version of any library

Related

I want to add google mobile ad dependency to my build.gradle file. But it is showing a red marked underline which occurs run time crash to my app

I want to show ad in my app using Admob. But when I add google mobile ad dependency to my build.gradle file and sync project, it is showing red underline. It is showing "All gms/firebase libraries must use the exact same version specification" How to solve it? I add google() to my build.gradle(project) file and tried to add updated version of dependency.
build.gradle file, project level gradle file, manifest file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.nabil.drawerlayout"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
}
```
project level gradle:
```
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
```
manifest file:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nabil.drawerlayout">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/logo"
android:label="#string/app_name"
android:roundIcon="#mipmap/logo"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity" />
<activity
android:name=".AfterSearchActivity"
android:parentActivityName=".MainActivity" />
<activity android:name=".AfterallBusFragmentActivity" />
<activity
android:name=".SplashScreenActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FaqActivity" />
<activity android:name=".AboutAppActivity" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/admob_app_id"/>
</application>
</manifest>
```

AAPT2 error: check logs for details(Build failed)

I just backed to my old project as I have been along time didn't work on it and I found a lot of errors as a build error in gradle as I use the compile instead implementation and many other process I tried to solve this error a lot but I failed as this my window error that's I couldn't recognize as I used also old Libraries from github
this is myGradle (build.gradle(Project:Waiterer))
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "abtech.waiteriano.com.waitrer"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':jtds-1.3.1')
implementation project(':library')
implementation project(':librarySV')
implementation 'com.android.support:support-v4:25.2.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:25.3.1'
implementation 'com.roughike:bottom-bar:1.3.9'
implementation 'com.android.support:recyclerview-v7:25.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
implementation 'com.github.clans:fab:1.6.2'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.android.support:cardview-v7:25.3.1'
testImplementation 'junit:junit:4.12'
implementation "com.android.support:gridlayout-v7:23.1.1"
}
and this my first gradle library I use
build.gradle(Module:library)
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:23.1.1'
}
and this is my second library I use
build.gradle(Module:librarySV)
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.novoda:bintray-release:0.8.1'
}
}
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.4.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:design:23.1.1'
}
publish {
userOrg = 'miguelcatalan'
groupId = 'com.miguelcatalan'
artifactId = 'materialsearchview'
publishVersion = '1.4.0'
desc = 'Cute library to implement SearchView in a Material Design Approach'
website = 'https://github.com/MiguelCatalan/MaterialSearchView'
}
hope this could be clear enough If any some thing not clear tell me
Note that: I am not using API I use JDBC JTDS Connection to retrieve data from data base
Thing is developers are not comfortable to new AS still. Way of showing error is changed (is weird now).
First scroll to down in build errors. If you see an error, click to expand it. It will show you error most probably.
Second If that does not work (like i faced in data binding, where no errors were shown)
Then try build with debug or stacktrace
Go to
File > Settings > Build, Execution, Deployment > Compiler
add like this (add --stacktrace or --debug), it will log the exceptions. You can see what is causing issue.
Okay, so the problem is with the AndroidManifest in your app module:
<activity android:name=".Main2Activity">
<service
android:name="SoftKeyboard"
android:permission="android.permission.BIND_INPUT_METHOD"
tools:ignore="WrongManifestParent">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="#xml/method" />
</service>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
According to the documentation the 'service' element must be nested under 'application' not 'activity'. So change that part of code to:
<activity android:name=".Main2Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="SoftKeyboard"
android:permission="android.permission.BIND_INPUT_METHOD"
tools:ignore="WrongManifestParent">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="#xml/method" />
</service>
This will fix the error you are getting from AAPT2. For your project to build successfully you will also need to update your dependencies as described here. If you do both, everything should build correctly. :)

Google play services update to 9.0.0 even though current version is 9.2.1

I'm having an issue with this google play services plugin. It is telling me to update from the current version to a previous one. I have looked at other threads on here and they all say to put the plugin at the end of the app based gradle, which I already did, but I am still getting the error.
Here is my manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mikediloreto.findingrestaurants">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:name=".MyApplication"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ProfileActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
And here is the app-based gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.mikediloreto.findingrestaurants"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
Here is the project based build gradle:
// 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:2.3.3'
classpath 'com.google.gms:google-services:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please let me know if you would like me to include any other code.
First of all here is something u shouldnt do
compile 'com.google.android.gms:play-services-maps:11.0.4'
and
compile 'com.google.android.gms:play-services-auth:9.2.1'
its a good practice to have on global variable for libs having the same versions
then u could do something like
compile "com.google.android.gms:play-services-auth:$google_ver"
might be that 11.xxx nd 9.xxx versions r cosing the trouble. Try using 11.0.4 instead of 9.2.1

android studio - upgrade firebase-ui 0.6.0 to 2.3.0 or latest version

When i trying to build and sync my project with firebase-ui 0.6.0 its all working fine. But when i tried to sync the project with newer version for example - 2.3.0 i am starting to get errors.
some ideas?
this is my level-application build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.mybudgetcontrol.mybudgetcontrol"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.android.gms:play-services-auth:11.2.0'
compile 'com.firebaseui:firebase-ui:0.6.0'
}
apply plugin: 'com.google.gms.google-services'
This is my Root-Level :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my AndroidManifest-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mybudgetcontrol.mybudgetcontrol" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".Activities.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
</application>
</manifest>
This is the Errors i get when upgrading
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.1) from [com.android.support:design:26.0.1] AndroidManifest.xml:28:13-35
is also present at [com.android.support:appcompat-v7:26.0.2] AndroidManifest.xml:28:13-35 value=(26.0.2).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
Please look at Compatibility with Firebase
If you are using firebase-UI, then the latest version of firebase supported is 11.0.4, But your project is using 11.2.0 which is not supported yet.
So I recommend you to change your firebase version until the next update of firebase UI

How to package a WatchFace only App for Google Play publishing

So far
I am developing a watch face app for android wear.
I have created 2 modules:
Wear - The Watch face that works fine on development
Mobile - An empty module with no activity as suggested by the comments
I have added the wear module to the mobile as a dependancy as described in packaging wear apps for the playstore
The app is in alpha in the playstore. I have uploaded the mobile-release.apk.
The app installs fine on my mobile but the wear module, the WatchFace will not install on my wear device. This is my problem.
What am I doing wrong?
Here are my manifests and Gradle configs
Mobile Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dimitrioskanellopoulos.athletica">
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" android:supportsRtl="true"
android:theme="#style/AppTheme">
</application>
Wear Manifest
<service
android:name="com.dimitrioskanellopoulos.athletica.WatchFaceService"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_rectangular" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_circular" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
Build.gradle for the Project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle for the mobile module
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
wearApp project(':wear')
}
Build.gradle for the wear module
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.android.support:wearable:1.4.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
compile 'org.apache.commons:commons-lang3:3.4'
}
Any help would be much appreciated!
Well after some time it installed. Took several uninstalls/installs.
The updated manifests are result of the comments and thanks for that.

Categories

Resources