firebase / quickstart-android

Firebase Quickstart Samples for Android
https://firebase.google.com
Apache License 2.0
8.88k stars 7.33k forks source link

Where is BaseEntryChoiceActivity? #899

Closed VirRajpurohit closed 5 years ago

VirRajpurohit commented 5 years ago

I have downloaded the source code and tried running mlkit out of it. I am unable to run it and ended up with several errors. few of them. ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :internal:chooserx.

I have commented the implementation in build.gradle file then bunch of errors I have recieved in EntryChoiceActivity as not finding imports for

import com.firebase.example.internal.BaseEntryChoiceActivity import com.firebase.example.internal.Choice import com.google.firebase.quickstart.fcm.java.MainActivity

google-oss-bot commented 5 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

samtstern commented 5 years ago

@VirRajpurohit thanks for filing this. How are you loading the project into Android Studio did you:

  1. Load the entire quickstart-android project and try to run the mlkit:app module? OR
  2. Load just the mlkit folder and try to run the app module?
samtstern commented 5 years ago

@VirRajpurohit I think I found and fixed the issue in https://github.com/firebase/quickstart-android/commit/4c75a7c8fb37a95367e4ca3f05c094fbec1af5cd

VirRajpurohit commented 5 years ago

@samtstern

I am using 2nd approach.

Changing include ':internal:chooserx' project(':internal:chooserx').projectDir = file('../internal/chooserx') helped to resolve most of this.

but yet ended up with the issue in import of below

import com.google.firebase.quickstart.fcm.java.MainActivity

Please assist.

samtstern commented 5 years ago

@VirRajpurohit that sounds like a different issue, are you trying to run the fcm quickstart?

VirRajpurohit commented 5 years ago

@samtstern No, I tried running MLKit only.

The issue is in EntryChoiceActivity.kt

return 
kotlin.collections.listOf(
                Choice(
                        "Java",
                        "Run the Firebase Cloud Messaging quickstart written in Java.",
                        Intent(this, MainActivity::class.java)),
                Choice(
                        "Kotlin",
                        "Run the Firebase Cloud Messaging written in Kotlin.",
                        Intent(this, MainActivity::class.java))
        )

The MainActivity in above code asks for import

import com.google.firebase.quickstart.fcm.java.MainActivity

Here is the code of manifest.xml

I think there is some issue persist in code yet

`<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.firebase.samples.apps.mlkit">

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MaterialTheme">
    <meta-data
        android:name="com.google.firebase.ml.vision.DEPENDENCIES"
        android:value="barcode,face,ocr,ica" />

    <activity
        android:name="com.google.firebase.samples.apps.mlkit.java.ChooserActivity"/>

    <activity
        android:name="com.google.firebase.samples.apps.mlkit.kotlin.ChooserActivity"/>

    <activity
        android:name="com.google.firebase.samples.apps.mlkit.EntryChoiceActivity"
        android:exported="true"
        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=".java.LivePreviewActivity" android:exported="true">
    </activity>

    <activity android:name=".kotlin.LivePreviewActivity" android:exported="true"/>

    <activity android:name=".java.StillImageActivity"
        android:exported="true">
    </activity>

    <activity android:name=".kotlin.StillImageActivity"
        android:exported="true"/>
</application>

`

samtstern commented 5 years ago

@VirRajpurohit I think your local state has gotten messed up. I can see the line you're talking about but it's not in the mlkit quickstart:

https://github.com/firebase/quickstart-android/blob/4c75a7c8fb37a95367e4ca3f05c094fbec1af5cd/messaging/app/src/main/java/com/google/firebase/quickstart/fcm/EntryChoiceActivity.kt#L6

As you can see in MLKit there is no such line: https://github.com/firebase/quickstart-android/blob/4c75a7c8fb37a95367e4ca3f05c094fbec1af5cd/mlkit/app/src/main/java/EntryChoiceActivity.kt#L7

I was able to run the following, which shows there is no build issue in messaging either:

cd messaging
./gradlew assembleDebug

I would say you should clear your local copy and clone again.

VirRajpurohit commented 5 years ago

@samtstern Thanks for your consistent help.

Now, while accesing StillImaheActivity and features inside.

I have some error of cloud vision API that it needs to be enabled, but I have not created any project over there.

My project is in firebase.

So does that needs to be added in google console as well?

Please asist.

samtstern commented 5 years ago

@VirRajpurohit yes if you want to use cloud models you will need to enable the cloud APIs on your project in the cloud console.

Also please file new issues for any more questions/bugs.

VirRajpurohit commented 5 years ago

@samtstern Perhaps, Last question in a raw

How I need to add the project on google console?

You mean separately same as I have added it on firebase?

Please assist.

Anuradha677 commented 4 years ago

@samtstern

I am using 2nd approach.

Changing include ':internal:chooserx' project(':internal:chooserx').projectDir = file('../internal/chooserx') helped to resolve most of this.

but yet ended up with the issue in import of below

import com.google.firebase.quickstart.fcm.java.MainActivity

Please assist.

Thanks for posting this. I was not included Internal folder due to that it was throwing the dependency errors. It is solved.