osmdroid setUserAgentValue Cannot resolve Method - android

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'

Related

cannt import v7 library

I want to know why my Android studio Cannot resolve AppCompactActivity symbol, when I try to add the AppCompat v7 library This import statement
import android.support.v7.app.AppCompatActivity;
shows up with gray color and says unused import statement
and v7 with red color and says Cannot resolve symbol'v7'
import android.support.v7.app.AppCompatActivity;
public class speech extends AppCompatActivity
build.grade:
compile "com.android.support:support-v4:${androidSupportLibraryVersion}"
compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.18'
compile 'de.cketti.library.changelog:ckchangelog:1.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.splitwise:tokenautocomplete:2.0.7'
compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
compile 'com.squareup.moshi:moshi:1.2.0'
compile "com.jakewharton.timber:timber:${timberVersion}"
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
testCompile "org.robolectric:robolectric:${robolectricVersion}"
testCompile "junit:junit:${junitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
testCompile 'org.jsoup:jsoup:1.10.2'
how can I solve this?
Add AppCompat Library in Gradel file.
compile "com.android.support:support-v4:${androidSupportLibraryVersion}"
compile "com.android.support:appcompat-v7:${androidSupportLibraryVersion}"
compile "com.android.support:support-annotations:${androidSupportLibraryVersion}"
Sometimes clearing the android studio caches help.
In android studio I just cleared the caches and restarted with the following option--
File->Invalidate Caches/Restart

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'

Selective Google Play Services API not finding classes

I've updated play services to the latest version, which currently is at 9.2.0 and I also want to use selective modules for the google play services.
// compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
The issue I'm having, is that now the imports like:
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.AutocompletePrediction;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
Cannot be resolved anymore, although in their documentation it is stated that location services should provide Places features also.
Can someone help me with this Issue? Thank you.
Based on the comment added by #Selvin, I managed to find the solution for my issue.
It seems that on version 9.x.x, Google Play Services API for Places was moved from play-services-location into play-services-places.
Thus, now I'm having the following dependencies for Google Play Services APIs:
// compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-places:9.2.0'

Cannot resolve SphericalUtil

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;

NoClassDefFoundError for apache/commons/lang/StringUtils

I want to use commons-lang3 in my project, with Android Studio.
Here is my gradle configuration:
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
Gradle build is done without error, I can use StringUtils. But in runtime, app crashes with this error:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/lang/StringUtils;
I also tried with .jar in lib folder but I get the same error.
change your gradle file to this:
implementation 'org.apache.commons:commons-lang3:3.6'
then you can use this import in your classes:
import org.apache.commons.lang3.StringUtils;

Categories

Resources