Cannot resolve SphericalUtil - android

I am trying to compute area of a polygon by SphericalUtil.computeArea() method but getting cannot resolve symbol SphericalUtil.
I have put the following line in gradle.build
compile 'com.google.maps.android:android-maps-utils:0.4.+'

compile 'com.google.maps.android:android-maps-utils:0.4.+'
That is not a valid dependency because there is a . between the 4 and the +, hence it cannot be resolved.
As is said on their official website, you should use this instead
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
without that extra dot.
Then you can use it with this import
import com.google.maps.android.SphericalUtil;

Related

Failed resolving dependencies due to OneSignal

I found the following question: Failed to resolve: com.android.support:customtabs:[26.0.0,26.1.0]
People marked it as duplicate (which is wrong ! see next sentence) or wrote something about Maven or cleaning project etc.
I have exactly the same problem for two days (failed to resolve customtabs and support-v4) and I did not change anything in my project which has been previously working. So I started looking for possible solutions and I found the problem - it is the OneSignal dependency - when I remove it, everything works fine. But I have already implemented notifications in my app - and don't know what to do now. I tried to compile the newest one (mentioned on OneSignal page)
compile 'com.onesignal:OneSignal:[3.6.0,3.99.99)'
But the result is same. Can anyone help?
UPDATE:
The problem can be very easy reproduced - please create a simple project and add this dependency mentioned below (it is from official OneSignal website https://documentation.onesignal.com/v3.0/docs/android-sdk-setup):
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
UPDATE 2:
These are my dependencies:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:25.3.1'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Adding
maven {
url "https://maven.google.com"
}
to the build.gradle solved the problem with OneSignal, but now I have a problem with Firebase:
java.lang.NoSuchMethodError: No static method zzdD(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzv; or its super classes (declaration of 'com.google.android.gms.common.util.zzv'
The error happens because you have some conflicted library in your dependency.
As in the documentation, it says:
Automatic Dependencies
OneSignal automatically adds the following dependencies;
com.google.android.gms - Version 11
com.android.support - Version 26
Please makes sure your project matches these versions if you run into
a mismatch version error.
For more details see the All gms/firesbase libraries must use the
exact same version specification section.
So, you need to remove or use the same dependencies in your project, something like this:
compile 'com.android.support:appcompat-v7:26.0.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.+'
compile 'com.google.firebase:firebase-database:11.0.+'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:26.0.+'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
Remove 'f' from dependency. also, use [ brackets instead of ). its a typo.
dependencies {
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
}
and this code in your root gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

What is the new way of adding compile 'com.google.firebase:firebase-database:9.6.0'?

When I initially used the code below in my build.gradle file, it helped me import the authentication.
compile 'com.google.firebase:firebase-auth:9.2.1'
After adding the below code to my build.gradle file
compile 'com.google.firebase:firebase-database:9.6.0'
Making me to have:
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-database:9.6.0'
together in my dependency, hence my authentication stopped working, displaying an error message in my MainActivity that I declared it.
"Cannot resolve symbol FirebaseUser" since FirebaseUser is what I named my import to be. Please help.
add same Dependencies version..
compile 'com.google.firebase:firebase-auth:9.6.0'
compile 'com.google.firebase:firebase-database:9.6.0'

osmdroid setUserAgentValue Cannot resolve Method

I have used this tutorial: https://github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library
But the Map doesn't show and I get an error: setUserAgentValue Cannot resolve Method
In this Line:
org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.setUserAgentValue(BuildConfig.APPLICATION_ID);
I have imported this:
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.views.MapView;
And in my Gradle this:
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'org.osmdroid:osmdroid-android:4.3'
osmdroid4.3 is out of date, and was not supporting setUserAgent.
Upgrade to the latest version, replace with:
compile 'org.osmdroid:osmdroid-android:5.4.1:release#aar'

Import android.support.v4.Fragment

enter image description here
Hi there
I face a problem with android studio,
it could not find the " fragment" in library,
i try to fix it from project structure and dependency then + then add "com.android.support:support-v4" but nothing changed.
your turn experts :).
go into the build.gradle (module app) file and you'll have something like this:
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
}
Add this line to it: compile 'com.android.support:support-v4:24.0.0' and than a bar in the top will appear, click rebuilt.
That's how you import libraries.

Android Studio: import com.android.volley.xxxx Cannot Resolve Symbol 'xxxx'

So, I followed this tutorial to create a ListView with images using Volley but I am having this issue with the com.android.volley.xxxx import statements in LruBitmapCache.java, AppController.java, CustomListAdapter.java, and MainActivity.java. It shows as Unused import statements and its extension are in red saying Cannot resolve symbol xxxx. Volley.jar is already aded to app -> libs section.
Would appreciate any help.
I'd double check to make sure your build.gradle includes:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
...
}
And also make sure you've ran a sync.
Add
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
to your Gradle dependencies...
Add this in your build.gradle of your app
https://developer.android.com/training/volley/
implementation 'com.android.volley:volley:1.1.1'

Categories

Resources