Google Play Services are randomly adding AD ID permission into my Manifest - android

I just found out that my Google Play Services are adding into merged manifest AD permission and for that reason I cant upload app to my playstore because it requires reasoning why I want ads in my app (I don't).
These are my gradle libraries:
//Google SDK
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.gms:play-services-auth:20.3.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.maps.android:android-maps-utils:2.0.3'
//GCM for internet connection monitoring
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
//GooglePay
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
//Google Firebase SDK - Crashlytics, Firebase Messaging
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation ('com.google.firebase:firebase-crashlytics:18.2.13') {
transitive = true
}
implementation 'com.google.firebase:firebase-messaging:23.0.8'
This is merged manifest:
It seems like its google analytics (firebase). But I don't want and don't use any ad content in my app so I don't understand why is Google adding this stuff into my app without my approval.
I just tried to do this:
implementation 'com.google.firebase:firebase-core:21.1.1' {
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
exclude module: "play-services-measurement-sdk"
}
as I found out but its not even compiling (got GradleScriptException):
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method com.google.firebase:firebase-core:21.1.1() for arguments [build_ballt3q1t2mmz35mzah3ugy17$_run_closure2$_closure23#69dcec81] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

Related

Firebase and Socket.io compatibility issue crash my app

Every time add firebase dependencies, run my app and socket connect to endpoint, my app crashes immediately.
I'm using firebase and socket.io together and is causing the crash due to compatibility issues. Can firebase and socket.io be used together?
I get the following error when i added firebase and try to connect to socket.io in my project
E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.project.hubrydemanagerapp, PID: 30101
java.lang.NoSuchMethodError: No virtual method callEngineGetConnection(Lcom/squareup/okhttp/Call;)Lcom/squareup/okhttp/Connection; in class Lcom/squareup/okhttp/internal/Internal; or its super classes (declaration of 'com.squareup.okhttp.internal.Internal' appears in /data/app/com.project.hubrydemanagerapp-t3ZbPD-QZAE9y2BMT64Cdg==/base.apk!classes3.dex)
at com.squareup.okhttp.ws.WebSocketCall.createWebSocket(WebSocketCall.java:154)
at com.squareup.okhttp.ws.WebSocketCall.access$000(WebSocketCall.java:42)
at com.squareup.okhttp.ws.WebSocketCall$1.onResponse(WebSocketCall.java:102)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
My dependencies:
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.3.0'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation('com.github.nkzawa:socket.io-client:0.6.0') {
exclude group: 'org.json', module: 'json'
}
Endpoint
"https://hubryde-trip-service.herokuapp.com/";
"https://hubryde-request-service.herokuapp.com/";
Connection. I'm using Application class to create socket model.
tripSocket = IO.socket(TRIP_URL);
socket2 = IO.socket(BUS_URL);
SocketEndpoint app = (SocketEndpoint) getApplication();
tripSocket = app.getmTripSocket();
if(!tripSocket.connected()) {
tripSocket.connect();
}
socket2 = app.getmBusLocationSocket();
if(!socket2.connected()) {
socket2.connect();
}
}
Im also Using com.github.nkzawa:socket.io-client:0.6.0.
That crash also happened to me after adding firebase in app messaging module,
for me the quick fix (until this will be fixed, hopefully soon..)
was to add exclude..
hope it helps..
implementation ('com.google.firebase:firebase-inappmessaging-display:19.0.3') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
my full gradle file: (Using AndroidX)
implementation 'com.github.nkzawa:socket.io-client:0.6.0'
implementation 'tech.gusavila92:java-android-websocket-client:1.2.2'
implementation "com.google.firebase:firebase-messaging:20.1.4"
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation ('com.google.firebase:firebase-inappmessaging-display:19.0.3') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
I have tested your dependencies and i realized firestore dependency is the reason for the crash not the entire firebase dependencies. It seems not to support The type of socket.io you are using OR not even support socket.io at all.
I even went further to test older version of cloud firestore, but no luck - The app keeps crashing with the same error.
So remove firestore and sync your project if you will see the error.

AutoComplete can't be found in new compatibility library and Gives Program Type Already Present With New Places Library

I was trying to add an AutoComplete feature while letting user select a place. I followed the official documents and implemented the feature. But if I just use the compatibility library ('com.google.android.libraries.places:places-compat:2.0.0') and don't use the new places library ('com.google.android.libraries.places:places:2.0.0') I cannot import anything useful related to AutoComplete.(only 4 classes from widget which are not useful for coding and I believe they cause the program type already present error when I include the new places library)
To start auto complete I use this code
val fields = Arrays.asList(Place.Field.ID,
Place.Field.NAME,
Place.Field.ADDRESS,
Place.Field.ADDRESS_COMPONENTS,
Place.Field.LAT_LNG,
Place.Field.OPENING_HOURS,
Place.Field.PHONE_NUMBER,
Place.Field.PRICE_LEVEL,
Place.Field.RATING,
Place.Field.TYPES,
Place.Field.PHOTO_METADATAS,
Place.Field.TYPES,
Place.Field.VIEWPORT,
Place.Field.USER_RATINGS_TOTAL)
val intent = Autocomplete.IntentBuilder(
AutocompleteActivityMode.FULLSCREEN, fields)
.build(this#AddPartnerActivity)
startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE)//Request code is just a number
}
Android doesn't suggest me any useful import while new places library is missing.When I use exclude in gradle Error: Program type already present: com.google.android.libraries.places.widget.AutocompleteActivityis not fixed. I can also paste my gradle file for your reference (it's a mess and I tried to write exclude into any import that can possibly create a problem). One important thing to note is code was working fine without adding the new places api if I don't use autocomplete.
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation ('com.google.android.gms:play-services-maps:16.0.0'){
exclude group: 'com.google.android.libraries.places.widget'
}
//Ion
implementation 'com.koushikdutta.ion:ion:2.+'
//Facebook Login
implementation 'com.facebook.android:facebook-login:4.41.0'
//Google Login
implementation 'com.google.android.gms:play-services-auth:16.0.1'
//Anko
implementation "org.jetbrains.anko:anko:$anko_version"
// Anko Layout
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
implementation "org.jetbrains.anko:anko-commons:$anko_version"
implementation "org.jetbrains.anko:anko-design:$anko_version"
//Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
//PlaceholderView
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.mindorks.android:placeholderview:1.0.3'
kapt 'com.mindorks.android:placeholderview-compiler:1.0.3'
//Web Sockets
implementation 'com.koushikdutta.async:androidasync:2.+'
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
//Gson
implementation 'com.google.code.gson:gson:2.8.5'
//Firebase Cloud Messaging
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'com.google.android.play:core:1.5.0'
//Kotlin Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
//Firebase Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
//Map Utility
implementation 'com.google.maps.android:android-maps-utils:0.5+'
//room
implementation 'androidx.room:room-runtime:2.0.0'
kapt 'androidx.room:room-compiler:2.0.0'
implementation 'com.google.android.gms:play-services-oss-licenses:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation ('com.schibstedspain.android:leku:6.2.1') {
exclude group: 'com.google.android.gms'
exclude group: 'androidx.appcompat'
exclude group: 'com.google.android.libraries.places.widget'
}
implementation ('com.google.android.libraries.places:places-compat:2.0.0'){
exclude group: 'com.google.android.libraries.places.widget'
}
implementation 'com.google.android.libraries.places:places:2.0.0')
apply plugin: 'com.google.gms.google-services'
My first mistake was that in compatibility library, I should use the Place prefix with AutoComplete to find the necessary imports.
val intent = PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN).build(this#AddPartnerActivity)
Second issue was that I wanted to get the property opening_hours(and data about photos) from Placeobject which was present in new places library, but not present in compatibility library. In compatibility library to retrieve this, one should send a query instead of creating a list of types he wants to retrieve directly from the place object like I did in the question.
Basically one should sent a request to this url using the id retrieved from autocomplete. Documentation for this can be found here place details
val url = "https://maps.googleapis.com/maps/api/place/details/json?placeid=$placeId&fields=opening_hours,photos,reviews&key=YOUR_API_KEY" //place id is the id of the place you got from autocomplete
My confusion came from the fact that you need to send a query in one library which I thnk is subject to billing while in the new api you can directly retrieve the opening hours.

error: cannot find symbol import com.firebase.ui.database.FirebaseRecyclerAdapter;

I have the right library and dependencies the build gradle(app) file. But I'm still etting this error.
According to some answers here, I have already tried all of them. I already checked if i have the right version, whether i have included the package correctly, whether the package name is same in google-service.json file, in manifest file, or in gradle file. I have already done all these.
// All google dependencies
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.firebaseui:firebase-ui:3.3.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.github.ar-android:DrawRouteMaps:1.0.0'
these are backdated on purpose.
as this answer(https://stackoverflow.com/a/39217164/11686135) suggests, i have already done that:
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
and this is the error its showing: Cannot resolve symbol 'database'
maybe somehow the dependencies not working...?
i am really novice at this. thanks in advance
Perhaps you are missing a dependency, please refer to the
GitHub project for FirebaseUI,
you might be missing just one more dependency such as any of these:
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:5.0.0'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
}
if someone is getting same issue then try searching for Firebase Dependencies latest version
and add it issue will be resolved
These are Latest dependencies add accordingly for use
To learn more
click here
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:6.3.0'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:6.3.0'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:6.3.0'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:6.3.0'
}
Firebaserecycleroption.
Basically android studio will change their version.
but build.gradle old dependencies are working in new version. So guys try to all dependecies in gradle.
gradle build dependencies:
compile 'com.firebaseui:firebase-ui-database:2.0.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.2'
implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
implementation 'com.firebaseui:firebase-ui-database:5.0.0'
implementation 'com.firebaseui:firebase-ui-database:6.3.0'
//( Below two dependencies are same apply both )
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile'com.firebaseui:firebase-ui-database:1.1.1'
implementation 'com.firebaseui:firebase-ui-database:8.0.1'
( must try it )

Firebase + Google Play Services = Error: "com.google.android.gms:play-services-basement ... [[15.0.1,15.0.1]], but resolves to 16.0.1"

I was getting my own version of the following error using vanilla Android (no React voodoo), and the other hacky solutions, namely this one, didn't work for me, so I'm posting what did.
After implementing firebase-core
implementation 'com.google.firebase:firebase-core:16.0.1'
in my Android project that was currently using
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
for Google Play location services, I got the following error:
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1
I just changed the lines in my app/build.gradle:
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
to
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
and did a Build > Clean Project

Android Firebase Authentication

mAuth!!.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(this){ task ->
if (task.isSuccessful){
Toast.makeText(applicationContext,"Successful login",Toast.LENGTH_LONG).show()
var currentUser =mAuth!!.currentUser
//save in database
if(currentUser!=null) {
myRef.child("Users").child(SplitString(currentUser.email.toString())).child("Request").setValue(currentUser.uid)
}
LoadMain()
}else
{
Toast.makeText(applicationContext,"fail login",Toast.LENGTH_LONG).show()
}
}
I get "developer warning for package 'com.example.package' Failed to post notification on channel 'null' See log for more details"
In the log
DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
GooglePlayServicesUtil: Google Play services out of date. Requires 11020000 but found 10932470
Notification: Use of stream types is deprecated for operations other than volume control
Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
I have
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
}
in build.gradle
I've been lookin at this https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels, but I don't know how to work on this
your version of play services is old.
use latest google play services in gradle:
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
}
For Oreo Copatability you must use channels and group them to run on Oreo (android O) otherwise your notifications will be dropped.
Use this link to Learn more about channels in Android O link
medium link
Read about android O changes here

Categories

Resources