I have a mapsActivity that don't load correctly. The Api key is well
configured because if I call to maps activity after the splashScreen everything works OK. My emulator has installed api 26
This is the log when I call Mapsactivity after splashScreen.
> I/FA: App measurement initialized, version: 22048
> I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
> I/FA: To enable faster debug mode event logging run:
> adb shell setprop debug.firebase.analytics.app com.lyntia.android.mera
> D/FA: Debug-level message logging enabled
> D/SplashScreenActivity: User has logged in, token OK
> V/FA: onActivityCreated
> I/zygote: Background concurrent copying GC freed 15298(1332KB) AllocSpace objects, 11(220KB) LOS >objects, 55% free, 1238KB/2MB,
> paused 2.344ms total 101.117ms
> V/FA: Connecting to remote service
> V/FA: Connection attempt already in progress
> I/zzbz: Making Creator dynamically
> W/zygote: Skipping duplicate class check due to unrecognized classloader
> I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module
> com.google.android.gms.maps_dynamite:221
> Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
> V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
> V/FA: Connection attempt already in progress
> W/zygote: Skipping duplicate class check due to unrecognized classloader
> I/zygote: Do partial code cache collection, code=30KB, data=22KB
> After code cache collection, code=30KB, data=22KB
> I/zygote: Increasing code cache capacity to 128KB
> I/Google Maps Android API: Google Play services client version: 12451000
> I/Google Maps Android API: Google Play services package version: 16089022
> I/zygote: Do partial code cache collection, code=52KB, data=38KB
> I/zygote: After code cache collection, code=52KB, data=38KB
> Increasing code cache capacity to 256KB
> D/skia: --- SkAndroidCodec::NewFromStream returned null
> V/FA: Activity resumed, time: 3535145
> I/FA: Tag Manager is not found and thus will not be used
> D/OpenGLRenderer: HWUI GL Pipeline
> I/zygote: Do full code cache collection, code=83KB, data=87KB
> D/: HostConnection::get() New Host Connection established 0xa3a7c440, tid 15830
> I/OpenGLRenderer: Initialized EGL, version 1.4
> D/OpenGLRenderer: Swap behavior 1
> I/zygote: After code cache collection, code=81KB, data=65KB
> W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
> D/OpenGLRenderer: Swap behavior 0
> D/EGL_emulation: eglCreateContext: 0xa63060a0: maj 2 min 0 rcv 2
> V/FA: Connection attempt already in progress
> V/FA: Connection attempt already in progress
> D/EGL_emulation: eglMakeCurrent: 0xa63060a0: ver 2 0 (tinfo 0x88213db0)
> E/RecyclerView: No adapter attached; skipping layout
> D/: HostConnection::get() New Host Connection established 0x932f0040, tid 15826
> D/EGL_emulation: eglCreateContext: 0xa6305920: maj 1 min 0 rcv 1
> D/EGL_emulation: eglMakeCurrent: 0xa63060a0: ver 2 0 (tinfo 0x88213db0)
> D/EGL_emulation: eglMakeCurrent: 0xa6305920: ver 1 0 (tinfo 0x92ef6900)
> D/FA: Connected to remote service
> V/FA: Processing queued up service tasks: 5
> I/zygote: Do partial code cache collection, code=111KB, data=97KB
> I/zygote: After code cache collection, code=102KB, data=92KB
> I/zygote: Increasing code cache capacity to 512KB
> W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not >found.
> I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote >module
> com.google.android.gms.googlecertificates:4
> Selected remote version of com.google.android.gms.googlecertificates, version >= 4
> W/zygote: Skipping duplicate class check due to unrecognized classloader
> V/FA: Inactivity, disconnecting from the service
> I/zygote: Do full code cache collection, code=240KB, data=192KB
> After code cache collection, code=208KB, data=138KB
> I/zygote: Do partial code cache collection, code=245KB, data=187KB
> I/zygote: After code cache collection, code=245KB, data=187KB
> Increasing code cache capacity to 1024KB
This is the log when I call mapsActivity in they correct place (Don't work).
D/EGL_emulation: eglMakeCurrent: 0xa3de7c80: ver 2 0 (tinfo 0xa3918900)
D/EGL_emulation: eglMakeCurrent: 0xa3de7c80: ver 2 0 (tinfo 0xa3918900)
V/FA: Recording user engagement, ms: 1649
V/FA: Activity paused, time: 671631
V/FA: onActivityCreated
I/zygote: JIT allocated 56KB for compiled code of void android.view.View.<init>(android.content.Context, android.util.AttributeSet, int, int)
I/zzbz: Making Creator dynamically
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/Google Maps Android API: Google Play services client version: 12451000
I/Google Maps Android API: Google Play services package version: 16089022
V/FA: Activity resumed, time: 672047
E/RecyclerView: No adapter attached; skipping layout
D/: HostConnection::get() New Host Connection established 0x9157a5c0, tid 7910
D/EGL_emulation: eglCreateContext: 0x911c7740: maj 1 min 0 rcv 1
D/EGL_emulation: eglMakeCurrent: 0xa3de7c80: ver 2 0 (tinfo 0xa3918900)
D/EGL_emulation: eglMakeCurrent: 0x911c7740: ver 1 0 (tinfo 0x90eec950)
D/EGL_emulation: eglMakeCurrent: 0xa3de7c80: ver 2 0 (tinfo 0xa3918900)
D/EGL_emulation: eglMakeCurrent: 0xa3de7c80: ver 2 0 (tinfo 0xa3918900)
W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
Selected remote version of com.google.android.gms.googlecertificates, version >= 4
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/zygote: Do full code cache collection, code=471KB, data=305KB
After code cache collection, code=467KB, data=235KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=495KB, data=276KB
I/zygote: After code cache collection, code=495KB, data=276KB
Increasing code cache capacity to 2MB
activity_maps.xml
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3" />
MapsActivity.java
import androidx.fragment.app.FragmentActivity;
import android.os.Bundle;
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.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
androidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MeraApp"
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Before mapsactivity there are some activities that get and post data from/to the server.
I don't know if it can be a problem with memory, cache...
Any help?
Related
In the project I made on Android studio, I put a button on the user login page to log in with a google account.The account name appears in the Choose an account section.
In the Authentication section, the name does not appear as an account login.The user's mail and password have been entered and saved.When I log into the application with that account, I want it to redirect to the other page, but it does not redirect to the MainActivity2.java page. I would be glad if you could help.
Run:
Connected to process 18504 on device 'emulator-5556'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/MultiDex: VM with version 2.1.0 has multidex support
Installing application
VM has multidex support, MultiDex support library is disabled.
I/ple.geziprojec: Waiting for a blocking GC ClassLinker
I/ple.geziprojec: WaitForGcToComplete blocked ClassLinker on ClassLinker for 176.388ms
W/ple.geziprojec: Verification of void com.google.android.gms.common.internal.StringResourceValueReader.<init>(android.content.Context) took 177.170ms (118.53 bytecodes/s) (1040B approximate peak alloc)
W/ComponentDiscovery: Class com.google.firebase.dynamicloading.DynamicLoadingRegistrar is not an found.
I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
I/FirebaseInitProvider: FirebaseApp initialization successful
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:20 and remote module com.google.android.gms.measurement.dynamite:21
Selected remote version of com.google.android.gms.measurement.dynamite, version >= 21
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/ple.geziprojec: Verification of void com.google.android.gms.common.api.internal.GoogleApiManager$zaa.connect() took 107.853ms (806.65 bytecodes/s) (2328B approximate peak alloc)
W/ple.geziprojec: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/ple.geziprojec: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
W/ple.geziprojec: Verification of void com.google.android.gms.common.internal.BaseGmsClient.zza(int, android.os.IInterface) took 133.587ms (3346.13 bytecodes/s) (5928B approximate peak alloc)
I/ple.geziprojec: The ClassLoaderContext is a special shared library.
I/ple.geziprojec: The ClassLoaderContext is a special shared library.
I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to fallback implementation
I/DynamiteModule: Considering local module com.google.android.gms.signinbutton_dynamite:0 and remote module com.google.android.gms.signinbutton_dynamite:2
Selected remote version of com.google.android.gms.signinbutton_dynamite, version >= 2
W/ple.geziprojec: Verification of int com.google.android.gms.common.internal.GmsClientSupervisor$zza.zzq() took 161.972ms (18.52 bytecodes/s) (720B approximate peak alloc)
V/FA: onActivityCreated
D/HostConnection: HostConnection::get() New Host Connection established 0xe9121d40, tid 18553
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0xe9124ba0: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xe9124ba0: ver 2 0 (tinfo 0xe9455f70) (first time)
I/Gralloc4: mapper 4.x is not supported
D/HostConnection: createUnique: call
D/HostConnection: HostConnection::get() New Host Connection established 0xe9123ef0, tid 18553
D/goldfish-address-space: allocate: Ask for block of size 0x100
allocate: ioctl allocate returned offset 0x3fe83c000 size 0x2000
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
W/ple.geziprojec: Verification of void ic.e() took 123.348ms (6809.95 bytecodes/s) (11464B approximate peak alloc)
W/ple.geziprojec: Verification of void ie.<init>(jc) took 152.305ms (98.49 bytecodes/s) (968B approximate peak alloc)
I/OpenGLRenderer: Davey! duration=771ms; Flags=1, IntendedVsync=4143801720841, Vsync=4143835054173, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=4143845992300, AnimationStart=4143846040000, PerformTraversalsStart=4143846105800, DrawStart=4144157390900, SyncQueued=4144354861800, SyncStart=4144360117400, IssueDrawCommandsStart=4144360507700, SwapBuffers=4144536078100, FrameCompleted=4144578165500, DequeueBufferDuration=318500, QueueBufferDuration=1625500, GpuCompleted=0,
W/ple.geziprojec: Verification of void lt.B() took 115.481ms (207.83 bytecodes/s) (992B approximate peak alloc)
I/Choreographer: Skipped 49 frames! The application may be doing too much work on its main thread.
I/OpenGLRenderer: Davey! duration=988ms; Flags=0, IntendedVsync=4143851699017, Vsync=4144668365651, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=4144680002300, AnimationStart=4144680060000, PerformTraversalsStart=4144680717500, DrawStart=4144727417500, SyncQueued=4144728390300, SyncStart=4144731782000, IssueDrawCommandsStart=4144731852000, SwapBuffers=4144734026400, FrameCompleted=4144844020200, DequeueBufferDuration=279000, QueueBufferDuration=16261600, GpuCompleted=0,
W/ple.geziprojec: Verification of void rc.<clinit>() took 163.597ms (378.98 bytecodes/s) (1416B approximate peak alloc)
V/FA: App measurement collection enabled
V/FA: App measurement enabled for app package, google app id: com.example.geziproject, 1:1088981466528:android:40238883a0fda69fa1f8c5
I/FA: App measurement initialized, version: 34027
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.geziproject
D/FA: Debug-level message logging enabled
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 4143853
I/FA: Tag Manager is not found and thus will not be used
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 5
V/FA: Recording user engagement, ms: 4309
V/FA: Activity paused, time: 4148164
V/FA: onActivityCreated
V/FA: Activity resumed, time: 4148325
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 214
V/FA: Activity paused, time: 4148556
D/FA: Application going to the background
D/CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10154; state: ENABLED
V/FA: Activity resumed, time: 4154166
V/FA: Inactivity, disconnecting from the service
W/ConnectionTracker: Exception thrown while unbinding
java.lang.IllegalArgumentException: Service not registered: ls#9d99311
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757)
at android.app.ContextImpl.unbindService(ContextImpl.java:1874)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:792)
at ci.f(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):1)
at ci.d(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):2)
at lt.E(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):9)
at ld.a(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):3)
at ef.run(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):3)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at iy.run(:com.google.android.gms.dynamite_measurementdynamite#204713100#20.47.13 (150700-0):5)
Gradle dependencies:
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:20.0.1'
implementation 'com.google.firebase:firebase-database:19.6.0'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
implementation platform('com.google.firebase:firebase-bom:26.2.0')
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'me.everything:providers-android:1.0.1'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-core:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
LoginActivity.java:
public class LoginActivity extends AppCompatActivity {
private SignInButton signInButton;
private GoogleSignInClient mGoogleSignInClient;
private FirebaseAuth mAuth;
private Button signout;
private final static int RC_SIGN_IN=123;
protected void onStart() {
super.onStart();
FirebaseUser user=mAuth.getCurrentUser();
if(user!=null){
Intent intent= new Intent(getApplicationContext(),MainActivity2.class);
startActivity(intent);
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
createRequest();
signInButton=findViewById(R.id.signin);
mAuth=FirebaseAuth.getInstance();
signout=findViewById(R.id.sign_out);
signInButton.setOnClickListener(v -> signIn());
}
private void createRequest() {
GoogleSignInOptions gso= new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(String.valueOf(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient= GoogleSignIn.getClient(this,gso);
}
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RC_SIGN_IN){
Task<GoogleSignInAccount> task=GoogleSignIn.getSignedInAccountFromIntent(data);
//handleSignInResult(task);
try{
GoogleSignInAccount account=task.getResult(ApiException.class);
Toast.makeText(getApplicationContext(),"giriş başarılı",Toast.LENGTH_LONG).show();
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show();
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = mAuth.getCurrentUser();
Intent intent= new Intent(getApplicationContext(),MainActivity2.class);
startActivity(intent);
} else {
Toast.makeText(LoginActivity.this,"başarısız",Toast.LENGTH_LONG).show();
}
});
}
MainActivity2.java:
public class MainActivity2 extends AppCompatActivity {
TextView name,mail;
Button logout;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
logout= findViewById(R.id.logout);
name=findViewById(R.id.name);
mail=findViewById(R.id.email);
GoogleSignInAccount signInAccount= GoogleSignIn.getLastSignedInAccount(this);
if(signInAccount!=null){
name.setText(signInAccount.getDisplayName());
mail.setText(signInAccount.getEmail());
}
logout.setOnClickListener(v -> {
FirebaseAuth.getInstance().signOut();
Intent intent=new Intent(getApplicationContext(),LoginActivity.class);
startActivity(intent);
});
}
}
I have an android app that does not require a log in, but I do have Anonymous sign-in enabled so that I can retrieve the userID from Firebase and use it to log specific events. I have the feeling that it just stopped retrieving the UID from Firebase.
What I've done to resolve the issue is the following:
updated all the dependencies
updated the emulator
Installed a new emulator
re-added the google services plugin
re-added google-services.json file
updated Android Manifest
I've tried to create a login-activity for the sake of testing, where through a button with an onclicklisterer, the user get's anoynmously logged in.
I've doubled checked Local History in Android Studio to see whether big changes were made to the code, not the case. See screenshot
Enabled and disabled anonymous login from the Firebase Console.
Re-written the entire code based on documentation from Firebase.
I've basically tried every solution there is
My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.superawesome.metime">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/wazzup"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Cardview" />
<activity android:name=".cardviewactivity" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxx" />
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
tools:replace="android:launchMode"
android:launchMode="standard" />
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
My code:
#Override
public boolean onOptionsItemSelected(#NonNull MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true; // go back to the first screen
case R.id.cardoverview:
startActivity(new Intent(this, cardviewactivity.class));
return true; //go to the screen where all the swiped right activities are stored
}
return super.onOptionsItemSelected(item);
}
#Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
#Override
public void onComplete(#NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w("This Tag", "getInstanceId failed", task.getException());
return;
} else {
Log.d("This tag", "We need this");
}
}
});
swipeDb = FirebaseDatabase.getInstance().getReference().child("Users");
final FirebaseFirestore db = FirebaseFirestore.getInstance();
//Anonymous user login to be registered in Firebase
mAuth = FirebaseAuth.getInstance();
mCurrentUser = mAuth.getCurrentUser(); // save the UID of the user in users in Firebase without having to log in
final String UID = mCurrentUser.getUid();
DatabaseReference currentUserDb = FirebaseDatabase.getInstance().getReference().child("Users").child("UID");
currentUserDb.setValue(UID); //save the User UID to the Firebase Realtime database
// Calling to the AdMob API to add advertisements to the banner in the main view.Gotta make that dough
// Change this to big cards in the future
final AdView adView = findViewById(R.id.adView);
final AdRequest adRequest = new AdRequest.Builder()
//.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
Screenshot to Firebase Authentication
Error I'm receiving from the logcat:
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseCrashlytics: Initializing Crashlytics 17.0.0
I/FirebaseInitProvider: FirebaseApp initialization successful
I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
V/FA: onActivityCreated
W/rawesome.metim: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
V/FA: App measurement disabled via the init parameters
I/FA: App measurement initialized, version: 28000
To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.superawesome.metime
D/FA: Debug-level message logging enabled
V/FA: Detected application was in foreground
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.superawesome.metime, PID: 21746
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.superawesome.metime/com.superawesome.metime.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3341)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3485)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2045)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7478)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference
at com.superawesome.metime.MainActivity.onCreate(MainActivity.java:118)
at android.app.Activity.performCreate(Activity.java:7989)
at android.app.Activity.performCreate(Activity.java:7978)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3316)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3485)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2045)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7478)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
V/FA: Connecting to remote service
D/FA: Event not sent since app measurement is disabled
com.superawesome.metime.MainActivity.onCreate(MainActivity.java:118) --> final String UID = mCurrentUser.getUid();
I've been trying to resolve this issue for over a week now with no success
Edit:
I know I can add listeners to see if the user is anonymously signed in or not. The whole problem around this is that the user is not being signed in anymore at all.
Edit2:
From logcat:
2020-05-30 12:39:53.655 23257-23297/com.superawesome.metime I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21600
2020-05-30 12:39:53.658 23257-23297/com.superawesome.metime V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2020-05-30 12:39:53.770 23257-23311/com.superawesome.metime I/TetheringManager: registerTetheringEventCallback:com.superawesome.metime
2020-05-30 12:39:53.818 23257-23303/com.superawesome.metime W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2020-05-30 12:39:54.025 23257-23303/com.superawesome.metime I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
2020-05-30 12:39:54.076 23257-23257/com.superawesome.metime I/FirebaseCrashlytics: Initializing Crashlytics 17.0.0
2020-05-30 12:39:54.220 23257-23257/com.superawesome.metime I/FirebaseInitProvider: FirebaseApp initialization successful
2020-05-30 12:39:54.332 23257-23332/com.superawesome.metime D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-05-30 12:39:54.342 23257-23332/com.superawesome.metime D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-05-30 12:39:54.362 23257-23332/com.superawesome.metime D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-05-30 12:39:54.527 23257-23315/com.superawesome.metime V/FA: App measurement disabled via the init parameters
2020-05-30 12:39:55.234 23257-23315/com.superawesome.metime I/FA: App measurement initialized, version: 28000
2020-05-30 12:39:55.247 23257-23315/com.superawesome.metime I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2020-05-30 12:39:55.267 23257-23315/com.superawesome.metime I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.superawesome.metime
2020-05-30 12:39:55.274 23257-23315/com.superawesome.metime D/FA: Debug-level message logging enabled
2020-05-30 12:39:57.009 23257-23315/com.superawesome.metime V/FA: Detected application was in foreground
2020-05-30 12:39:57.995 23257-23315/com.superawesome.metime V/FA: Connecting to remote service
2020-05-30 12:40:23.846 23257-23311/com.superawesome.metime W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
2020-05-30 12:41:23.931 23257-23311/com.superawesome.metime W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
2020-05-30 12:42:54.030 23257-23311/com.superawesome.metime W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
I know that similar questions to this have been asked here before, but this is boggling my mind. I have researched this error and it seems to mostly pop up when you are referencing some part of an array outside its bounds or something, but this error ONLY occurs when I run the app on a virtual device with an API below 23. The machine it fails on is a Galaxy Nexus on API 22, however it also fails on a Nexus 4 with API 22. I tested it also on a virtual Nexus 4 with API 23 and it works, every API above this also works. I want my minimum SDK to be even lower but until I resolve this that will be impossible. Below is some code to help you geniuses see what's driving me insane.
(Cursor resultSet is set globally but it doesn't make a difference)
resultSet = mydatabase.rawQuery("SELECT * FROM words WHERE" + allowRepeats + " frequency >= 0 ORDER BY RANDOM() LIMIT 1",null); -THIS is the line that breaks no matter what I do.
This code renders to "SELECT * FROM words WHERE solved < 1 AND frequency >= 0 ORDER BY RANDOM() LIMIT 1" and this code works on EVERY API above 22, but when running on 22 I get the error "A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2c in tid 27273 (ics.choicewords)"
Some notes on what I've tried:
I have made sure that the database does exist and like I said it works on other APIs
I have tried setting the cursor just to null and returning empty strings as the result instead of any data, this works fine but of course is not an option
The rawQuery is run inside a loop that cycles 4 times, but taking it out and just running that single line once still breaks with the same error
Error Log:
I/art: Rejecting re-init on previously-failed class java.lang.Class<Tz>
Rejecting re-init on previously-failed class java.lang.Class<Tz>
W/cr_media: Requires BLUETOOTH permission
E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
D/: HostConnection::get() New Host Connection established 0xae9b0880, tid 5080
E/chromium: [ERROR:gl_surface_egl.cc(411)] eglChooseConfig failed with error EGL_SUCCESS
D/EGL_emulation: eglCreateContext: 0xae9bf7c0: maj 2 min 0 rcv 2
I/Ads: This request is sent from a test device.
D/EGL_emulation: eglMakeCurrent: 0xae9bf7c0: ver 2 0 (tinfo 0xae839eb0)
E/chromium: [ERROR:gl_surface_egl.cc(411)] eglChooseConfig failed with error EGL_SUCCESS
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
I/art: Background partial concurrent mark sweep GC freed 2186(176KB) AllocSpace objects, 1(12KB) LOS objects, 33% free, 7MB/11MB, paused 9.052ms total 67.508ms
W/Ads: Invoke Firebase method getInstance error.
The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
D/EGL_emulation: eglCreateContext: 0xaea6c640: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xaea6c640: ver 2 0 (tinfo 0xae839eb0)
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2c in tid 4979 (ics.choicewords)```
I fixed this error a long time ago, so I'm not entirely sure how, but looking back at my old code, it appears the error was created when there were no results that matched the query. I accounted for this afterwards by checking the resultSet count, if it was < 1, I replaced the resultSet with a set of arbitrary values that my app would understand meant no-results. This resolved the issue!
Trying to tweak the app by launching the DetectorActivity(main activity that does the detection) only when a button is clicked.
So within the source code, I've added a class "Main Activity", set it as the launching activity in the manifest, and in it's xml, added a button that when clicked, should send an intent to the DetectorActivity and launch it. The code is pretty much this :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void on(View v){
Intent i = new Intent(this,DetectorActivity.class);
startActivity(i);
}
However, the activity is never launched, which is quite baffling.
Here is the logcat of the emulator:
I/art: Ignoring second debugger -- accepting and dropping
12-21 20:39:13.111 23543-23550/.abc I/art: Ignoring second debugger -- accepting and dropping
12-21 20:39:13.563 23543-23543/.abc W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-21 20:39:13.745 23543-23554/abc I/art: Background sticky concurrent mark sweep GC freed 9521(535KB) AllocSpace objects, 0(0B) LOS objects, 75% free, 950KB/3MB, paused 8.576ms total 187.364ms
12-21 20:39:14.110 23543-23543/abc I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-21 20:39:14.112 23543-23543/.abc I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-21 20:39:15.082 23543-23577/abc D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-21 20:39:15.338 23543-23577/.abc I/OpenGLRenderer: Initialized EGL, version 1.4
12-21 20:39:15.338 23543-23577/abc W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
12-21 20:39:15.387 23543-23577/abc D/EGL_emulation: eglCreateContext: 0x7f758dd74f40: maj 2 min 0 rcv 2
12-21 20:39:15.403 23543-23577/abc D/EGL_emulation: eglMakeCurrent: 0x7f758dd74f40: ver 2 0 (tinfo 0x7f758dd532a0)
12-21 20:39:15.777 23543-23577/abc D/EGL_emulation: eglMakeCurrent: 0x7f758dd74f40: ver 2 0 (tinfo 0x7f758dd532a0)
12-21 20:39:16.102 23543-23543/abc I/Choreographer: Skipped 56 frames! The application may be doing too much work on its main thread.
12-21 20:57:47.896 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping
12-21 20:57:47.909 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping
12-21 21:00:48.853 23543-23550/abc I/art: Ignoring second debugger -- accepting and dropping
Any help in this matter would be truly appreciated!
How are you setting the click listener? This log suggests it's not being called.
The comment by #RyanMentley solved it, thanks a bunch.
I am running a downloaded tested code from an Android app development course by Rob Percival in Android studio.
The code is for fetching HTML content of a specified URL and displaying it in the logs.
It's the tested code provided by the author of the course.
The code runs fine but only a part of the HTML content of the specified URL is displayed in the logs.
These are the additional log entries I'm getting:
(After displaying partial html content)
I/art: Background sticky concurrent mark sweep GC freed 81(3KB) AllocSpace objects, 43(11MB) LOS objects, 37% free, 6MB/10MB, paused 1.012ms total 115.686ms
D/: HostConnection::get() New Host Connection established 0xa63c98c0, tid 10451
D/: HostConnection::get() New Host Connection established 0xa63c9d80, tid 10487
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xa83cdf20: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xa83cdf20: ver 2 0 (tinfo 0xa84e32d0)
D/EGL_emulation: eglMakeCurrent: 0xa83cdf20: ver 2 0 (tinfo 0xa84e32d0)
Any help would be appreciated.
Thanks.