capacitor-community / firebase-analytics

Enable Firebase Analytics for Capacitor Apps
MIT License
162 stars 64 forks source link

Android not tracked #174

Open mattcreation opened 10 months ago

mattcreation commented 10 months ago

Hello i'm facing an issue that capacitor analytic is tracking on web but ont on may Android app. i tryed to check on forums and found adding on my mainActivity.java :

import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;

import com.getcapacitor.BridgeActivity; import com.getcapacitor.Plugin; import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics; import android.os.Bundle; import java.util.ArrayList;

public class MainActivity extends BridgeActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
        // Additional plugins you've installed go here
        add(FirebaseAnalytics.class);
    }});
}

}

but seem import com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics; won't be import and say "can not resolve community symbol", so the code is not working

i have already add dependencies:

dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion" implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion" implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion" implementation project(':capacitor-android') testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" implementation project(':capacitor-cordova-android-plugins') implementation 'com.google.android.gms:play-services-auth:16.0.0' implementation 'com.google.firebase:firebase-auth:16.0.3' implementation 'com.facebook.android:facebook-core:5.0.0' implementation platform('com.google.firebase:firebase-bom:31.2.3') implementation 'com.google.firebase:firebase-analytics:21.2.2' }

What do i missed?