Android studio - package com.google.android.gms.authn does not exist - android-studio

Using android-studio 1.5 and getting error when run in device
Error:(26, 36) error: package com.google.android.gms.authn does not exist
Added in gradle setting
dependencies {
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-location:+'
}. Help to fix

Related

Pointing Android Studio to specific cmake version

I use Android Studio 4.0.1
In my project, my local.properties has the following properties:
sdk.dir=C\:\\Users\\xxx\\AppData\\Local\\Android\\Sdk
ndk.dir=c\:\\yyy\\tools\\android-ndk-r19c
cmake.dir=c\:\\zzz\\cmake-3.17.0-win64-x64
Despite this, I get a compilation error when I Build -> Rebuild project or Clean project because my CMakeLists.txt begins with cmake_minimum_required(VERSION 3.14.3) and Android Studio uses the CMake included in the Android Studio folder instead of the one I point to in cmake.dir:
CMake Error at CMakeLists.txt:5 (cmake_minimum_required):
CMake 3.14.3 or higher is required. You are running version 3.10.2
-- Configuring incomplete, errors occurred!
See also "C:/Users/xxx/AndroidStudioProjects/E2e/app/.cxx/cmake/debug/x86/CMakeFiles/CMakeOutput.log".
FAILED: build.ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
C:\Users\xxx\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\cmake.exe -HC:\Users\xxx\AndroidStudioProjects\E2e\app\src\main\cpp -BC:\Users\xxx\AndroidStudioProjects\E2e\app\.cxx\cmake\debug\x86
What am I missing for AS to pick up the cmake 3.17 I already installed when I select Rebuild Project or Clean Project?
Notes:
The directory I point to with cmake.dir is valid and being read by AS. If I introduce a typo in the path, AS complains about it.
This problem only occurs when I do Build --> Rebuild project or Clean project. If instead I do Build --> Make project, then AS will pick up the cmake version that I point to in local.properties
Clean Project worked again after deleting .cxx folder
I'm not sure about Android Studio, but you could try editing the project's build.gradle :
android {
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
version '3.24.1'
}
}
}
.... and CMakeLists.txt :
cmake_minimum_required(VERSION 3.24.1)

Getting this error while running ionic code in Android studio - AGPBI: {"kind":"error","text":"No resource identifier found for attribute

I am working with Ionic project and I need to run this project with my android studio. I have resolved all the issues which are coming in the gradle file but when I am trying to run the code getting below error
error - No resource identifier found for attribute 'appComponentFactory' in package 'android'
enter image description here
above image is when I have fixed all the issue
but getting below error on runtime
**AGPBI: {"kind":"error","text":"No resource identifier found for attribute \u0027appComponentFactory\u0027 in package \u0027android\u0027","sources":[{"file":"/Users/naya-pc/Documents/Ionic/xyz/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml","position":{"startLine":57}}],"original":"","tool":"AAPT"}
/Users/naya-pc/Documents/Ionic/xyz/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:58: error: No resource identifier found for attribute 'appComponentFactory' in package 'android'
:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt**
Also, I have tried the basic technique to resolve this type of issue
1. clean project
2. rebuild project
3. invalidate the cache and restart
but still getting the same issue.
I have changed almost every gradle file with the new one and old one but getting the same issue below are my gradle and they are working gradle.
compile "com.android.support:support-v4:22.0.0"
compile "com.android.support:appcompat-v7:22.0.0"
compile "com.facebook.android:facebook-android-sdk:4.+"
compile "com.google.gms:google-services:+"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
compile "com.google.android.gms:play-services-base:15.0.1"
compile "com.google.android.gms:play-services-ads:15.0.1"
compile "com.google.android.gms:play-services-auth:15.0.1"
compile "com.google.android.gms:play-services-identity:15.0.1"
Please help me if you have any solution for this issue.

gradle fails at compiling sample project (appcompat-v7:23.3.0)

I'm trying to clone Udacity Android's Basics course project. I've cloned the project from GitHub and imported it in my Android Studio 2.1.2.
When I try to run it, gradle generates errors as follow:
Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:23.3.0
Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:23.3.0
Error:(25, 13) Failed to resolve: com.android.support:support-v4:23.3.0
I've updated all my SDKs but it still generates the error.
Also when I click on "Install Repository and Sync Project" link in the gradel messages, it says:
Following packages are not available:
Package id: extras;android;m2repository
Can anybody tell me what's wrong, why exactly gradle is not working, and how can I fix it?
Follow the simple steps:
1) Open any android project which is working on your SDK.
2) Open the build.gradle(Module:app) file.
3) copy the dependencies
eg:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
}
4) paste them in your current project.
5) Also see the
compileSdkVersion 24
buildToolsVersion "24.0.0"
They should match with what ever is written after v7 support library (android_support_lib_version).
6) Finally sync the project once again.

Some gradle issue after updating Android Studio to v2.0

I have updated Android Studio, and when opening a project done in the 1.5 version this is the error I am getting:
Error:Failed to open zip file. Gradle's dependency cache may be
corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires
network)
The following is my dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
}
I faced the same issue when I updated my android studio to 2.2.3 from 2.1.
After a while of struggling, went project->right click -> open module settings->project
1) Gradle : 2.14.1
2) Android plugin version : 2.2.3
3) Android plugin repository : jcenter
4) Default library repository : jcenter

Android error: package android.os does not exist

I have imported a project to Android Studio using Gradle. Import process was successful, but it gives an error for android.os.*, when I try to import it.
It is a libGDX project.
I suggest to use AGP Upgrade assistent.
I often have probs upgrading gradle. This time with artic fox and java 11 it I got all those infamous android.* not found errors.
Then I discovered that neat AGP Upgrade assistent (in tools since Studio 4.2) - and it did what it should and everything is now using gradle 7 and compiles again.
About time such a tool was introduced - and I just saw about half a year too late ;)
Recently, I met a similar case in Android Studio 3.2.1 Ubuntu/Linux version.
I am quite sure about the issue shall be related to the Android SDK installation,because I build the same project in Android Studio of my Windows 10 laptop.
Issue:
Java compiler error at Android studio
error: package android.os does not exist
error: package android.media does not exist
error: package android.content does not exist
error: package android.util does not exist
error: cannot find symbol variable Log
error: cannot find symbol class Context
error: cannot find symbol class AudioRecord
Solution:
The android.jar which was mentioned at the build.gradle file was not installed at the /sdk/platforms/ directory. See the android.jar dependency at my build.gradle file below(which caused the issue),
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files(sdkDir+'/platforms/android-24/android.jar')
}
Install the correct android platform(correct API level as mentioned in the build.gradle file,if any) and rebuild the project.
I am building from an old article, https://medium.com/#authmane512/how-to-build-an-apk-from-command-line-without-ide-7260e1e22676, and it doesn't yet have a build.gradle file, but I had the same error. I solved it by changing the compile command in my Makefile to:
classes: $(SOURCES)
javac -d obj \
-source 1.6 \
-target 1.8 \
-classpath src \
-bootclasspath $(ANDROID) \
$+
where ANDROID is /usr/local/src/android/adt-bundle-linux-x86_64-20130717/sdk/platforms/android-19/android.jar.
I get warnings now that source value 6 is obsolete, but at least it compiles.
In my case it was showing same kind of error with android.content.context
I figured out that the issue is I was using old gradle version with below android params in build.gradle
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
So I removed this and the error is no more.

Resources