So i was going through many stackoverflow answers and i tried applying them on my code, but i still couldn't find fix for this error. Also this error happens only when i try to Run the app only. i can build the project without any issues.
So this is the error i'm getting.
error: cannot access zzbgl class file for com.google.android.gms.internal.zzbgl not found
Also after that i'm getting this as a warning
D:\FinalProject\app\src\main\java\com\example\www\mytaxiapp\Welcome.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.
So far i tried changing the versions and commenting, also adding and removing dependencies, but still i was unable to find a solution for this. hope someone can help me here.
This is my gradle APP level file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.www.mytaxiapp"
minSdkVersion 16
targetSdkVersion 28
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 'com.android.support:multidex:1.0.3'
implementation 'com.github.glomadrian:MaterialAnimatedSwitch:1.1#aar'
implementation 'com.firebase:geofire-android:2.1.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
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.firebase:firebase-core:16.0.1'
implementation 'com.android.support:design:27.1.0'
//Add Library
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
My Welcome.class file imports
package com.example.www.mytaxiapp;
import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Handler;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.widget.Toast;
import com.firebase.geofire.GeoFire;
import com.firebase.geofire.GeoLocation;
import com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Welcome extends FragmentActivity implements OnMapReadyCallback,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener
{
Updating location service did the work for me ;)
implementation 'com.google.android.gms:play-services-location:15.0.1'
Google GMS is a very large dependency. You could try to enable multidex (by adding following line to your defaultConfig:
defaultConfig {
...
multiDexEnabled true
...
}
If you are targeting lower Android-versions, it can be, that you need to include support-Multidex as a dependency:
implementation 'com.android.support:multidex:1.0.3'
In this case, you should add a Application-class whilst you overwrite attachBaseContext like this:
#Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
super.attachBaseContext(base);
}
Please don't forget the clear project and gradle-sync.
Hope that helps.
Related
I keep getting such an error, what's wrong? and Have another problem?
This gives the first three red-shaped bugs!
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppcompatActivity;
import android.support.annotation.IdRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar
;
I am new to android development, and I have been using the command line tools to create an android project. I followed all the instructions given in the tutorial at android developers. However, they are focused more on IDE users.
findbugs {
sourceSets = []
ignoreFailures = false
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "video.compress.optimizasyon"
minSdkVersion 19
targetSdkVersion 29
versionCode 20
versionName "0.20"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable "GoogleAppIndexingWarning"
disable "MissingTranslation"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// ACRA depends on Java 8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'commons-io:commons-io:2.6'
implementation group: 'com.google.guava', name: 'guava', version: '24.1-jre'
implementation 'com.nononsenseapps:filepicker:4.2.1'
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.18'
implementation group: 'org.javatuples', name: 'javatuples', version: '1.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
implementation 'ch.acra:acra:4.11'
implementation 'com.google.android.gms:play-services-ads:18.2.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
You are using androidx libraries.
Remove this dependency, since you are using the Material Components library:
implementation 'com.android.support:appcompat-v7:27.0.0'
Then change these classes (code and layout):
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppcompatActivity;
import android.support.annotation.IdRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar
to
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.IdRes;
import androidx.appcompat.app.ActionBar;
//import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar
Here the full class mapping.
i'm going to integrate firebase to my android project, but after following the tutorial i found that this error showing up
error: package android.support.v7.app does not exist.
i tried to clean the project,and i checked update in android .
this is my build.gradle [module ]
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.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-auth:17.0.0'
}
and this my build.gradle [ project ]
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
please help to solve this problem i spent all this day looking for a solution . thank you
For latest version (3.4 or higher) of Android Studio
Instead of
import android.support.v7.app.AppcompatActivity
Use this
import androidx.appcompat.app.AppcompatActivity
In MainActivity.java or in main java file
I think you should Migrate to AndroidX if you want to use 'com.google.android.gms:play-services-auth:17.0.0' (17.0.0 version) or if you don't want to migrate androdiX use version 16.0.0 implementation 'com.google.android.gms:play-services-auth:16.0.0'
The c in AppcompatActivity must be in uppercase:
import androidx.appcompat.app.AppCompatActivity
I'm creating a new android project with SDK 28 when project finished to create I have an error in MainActivity.
I tried some methods:
Clean project
Clean Android Studio cache
Clean Gradle cache
Re-installed IDE
File-> Invalidate cache/restart
Remove .idea folder
Restart Android Studio.
Android Studio About:
Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 15, 2019
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.israteneda.myapplicationtest2"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}
MainActivity.java
package com.israteneda.myapplicationtest2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
The error showed is:
Android resource linking failed
error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.israteneda.horariu:style/Theme.AppCompat.Light.DarkActionBar) not found.
D:\israt\android_apps\HorariU\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:173: error: style attribute 'attr/colorPrimary (aka com.israteneda.horariu:attr/colorPrimary)' not found.
D:\israt\android_apps\HorariU\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:174: error: style attribute 'attr/colorPrimaryDark (aka com.israteneda.horariu:attr/colorPrimaryDark)' not found.
D:\israt\android_apps\HorariU\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:175: error: style attribute 'attr/colorAccent (aka com.israteneda.horariu:attr/colorAccent)' not found.
error: failed linking references.
When I change the SDK to 27 the MainActivity works.
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.israteneda.horariu"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}
MainActivity.java
package com.israteneda.myapplicationtest2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Also works with androidx library.
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.israteneda.myapplicationtest"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
MainACtivity.java
package com.israteneda.myapplicationtest;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I expect to create an android project without problems, but the actual output is an error with AppCompatActivity on MainActivity. Why does this problem happen?
I got the same issue and solved it by updating Android Studio
1.Go to your project directory (or to Project View)
2.Find and open .idea directory
3.Remove caches and libraries directories
4.Invalidate Caches / Restart
The problem was solved by updating the new version of android studio 3.4, without importing the settings of the previus version.
I use eclipese 2018-09 (4.9.0) I'm try to use jfreechart, I added the jars in the module path(jcommon,jfreechart), I do organize import
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.util.Rotation;
i get "The import org.jfree.chart cannot be resolved" for all imports and the consequential errors, what's the problem?Thanks
I imported mixare source code to Android Studio 3.1 but I get error message Cannot resolve symbol 'maps' in following lines:
import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
import com.google.android.maps.Projection;
I saw this page but none of the answers were helpful. How can I fix this?
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'org.mixare'
minSdkVersion 14
targetSdkVersion 24
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation project(':mixarelib')
implementation 'com.google.android.gms:play-services-maps:12.0.0'
}
AndroidManifest.xml:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
tools:ignore="AllowBackup"
tools:replace="android:label">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="(API KEY)" />
<uses-library android:name="com.google.android.maps" />
...
I solved this very easily.
Go to Settings | Appearance & Behavior | Android SDK and check 'Show Package Details'.
Select SDK version(I selected 7.0), check 'Google APIs' and install it. I don't know why the option doesn't exist in the version 7.1.1 and over.
And configure build.gradle like this:
compileSdkVersion 'Google Inc.:Google APIs:24'