Giter Club home page Giter Club logo

Comments (24)

berkus avatar berkus commented on July 17, 2024 3
  1. Delete everything
  2. Clone [email protected]:twilio/twilio-chat-demo-android.git
  3. Switch to java branch
  4. Copy google-services.json which includes com.twilio.chat.demo and com.twilio.chat.demo.debug client_infos to chat-demo-android/ folder.
  5. Build.

Do NOT modify any names until you have built successfully in step 5.

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024 1

You only need to edit the google-services.json file.

Find a section that google has generated for you - it contains your package name without flavors.

It's inside an array - copy the entire JSON object in that array to make another instance of it and simply rename the package.

E.g.:

in your original json file

{
  "project_info": {
    "project_number": "some number",
    "firebase_url": "https://some url.firebaseio.com",
    "project_id": "some id",
    "storage_bucket": "some bucket.appspot.com"
  },
  "client": [ <-- here is the start of the array
    { <-- this is the first line you need to copy
      "client_info": {
        "mobilesdk_app_id": "blabla",
        "android_client_info": {
          "package_name": "com.twilio.chat.demo" <-- this is the package name
        }
      },
      "oauth_client": [
        {
          "client_id": "other stuff",
          "client_type": x
        }
      ],
      "api_key": [
        {
          "current_key": "very secret key"
        }
      ],
      "services": {
        some services here
      }
    } <-- this is the last line you need to copy
  ], <-- this is the end of the array
  "configuration_version": "1"
}

in this file you will copy the marked section, rename only the package id in the second copy and get something like this:

{
  "project_info": {
    "project_number": "some number",
    "firebase_url": "https://some url.firebaseio.com",
    "project_id": "some id",
    "storage_bucket": "some bucket.appspot.com"
  },
  "client": [ <-- here is the start of the array
    {
      "client_info": {
        "mobilesdk_app_id": "blabla",
        "android_client_info": {
          "package_name": "com.twilio.chat.demo" <-- original package name left as it was
        }
      },
      "oauth_client": [
        {
          "client_id": "other stuff",
          "client_type": x
        }
      ],
      "api_key": [
        {
          "current_key": "very secret key"
        }
      ],
      "services": {
        some services here
      }
    }, <-- don't forget to add comma here!
    { <-- this is the first line you copied
      "client_info": {
        "mobilesdk_app_id": "blabla",
        "android_client_info": {
          "package_name": "com.twilio.chat.demo.debug" <-- this is the package name, updated to match your flavor
        }
      },
      "oauth_client": [
        {
          "client_id": "other stuff",
          "client_type": x
        }
      ],
      "api_key": [
        {
          "current_key": "very secret key"
        }
      ],
      "services": {
        some services here
      }
    } <-- this is the last line you copied
  ], <-- this is the end of the array
  "configuration_version": "1"
}

if you have other flavors in addition to debug just add more copies of this section and rename package to add those flavors too.

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

Not sure without build log what place you mean exactly.

I believe you're talking about google-services.json file? It should also have a matching package name.

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

Thanks for your response.

I have the same package name in google-service.json file.

  "client_info": {
        "mobilesdk_app_id": "1:339526072298:android:a06401e0e9f54a82",
        "android_client_info": {
          "package_name": "com.twilio.chat"
        }
      },

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

com.twilio.chat is the namespace for the SDK, it's probably a good idea to use some other name for your app.

Can you provide part of the build log where the error happens?

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

screen shot 2018-05-09 at 4 30 47 pm

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

You changed the name in the google-services.json but did not change the app name everywhere else (java packages, AndroidManifest.xml etc).

There's still com.twilio.chat.demo somewhere and it tries to find it in the google-services.json.

I also recommend using some other name for the app, not com.twilio.chat as this is inside Twilio domain and may conflict with other packages.

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

screen shot 2018-05-09 at 4 51 13 pm

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

In fact when I use same package name which is in this demo project. Still getting the same error.

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

ok, Thanks for your time. Let me try it.

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

Checking, how did it go? Do you still have any problems building it?

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

Sorry, I haven't spent time on this demo due to another work. Whenever I check definitely let you.

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

Closing this due to inactivity, reopen when you have more feedback. Thanks!

from twilio-chat-demo-android.

hardy-android avatar hardy-android commented on July 17, 2024

Sorry for inactivity here. But I tried above steps and it's working fine.

Thank you Berkus Decker.

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

Great! Glad to hear.

from twilio-chat-demo-android.

nipunravisara avatar nipunravisara commented on July 17, 2024

I got the same problem with use of react-native-firebase.

In your copy client > client_info > android_client_info: your app name in google-services.json

then psate it to android > defaultConfig > applicationId.

this worked for me.

from twilio-chat-demo-android.

eistrup avatar eistrup commented on July 17, 2024

I had to change the app package name in google-services.json files too

from twilio-chat-demo-android.

MadSkills420 avatar MadSkills420 commented on July 17, 2024

org.gradle.api.GradleException: No matching client found for package name 'com.hypertrack.ridesharing.android.github' can someone help me with this ?

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

@MadSkills420 yes, you need to have matching app name in your google-services.json

from twilio-chat-demo-android.

bhushang098 avatar bhushang098 commented on July 17, 2024

even After Trying above Steps i have same issue
it night be the problem due to product flavors i am using in my project

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

@bhushang098 I usually copy the provisioning in google-services.json and rename the second one to match the flavor I use (e.g. I add a second entry and rename it to "com.hypertrack.ridesharing.android.github.debug" etc)

from twilio-chat-demo-android.

bhushang098 avatar bhushang098 commented on July 17, 2024

thanks for Your Response berkus
i am quiet new to development can u please describe exactly how it is done
i have spent my whole day deleting and renaming packages

from twilio-chat-demo-android.

bhushang098 avatar bhushang098 commented on July 17, 2024

Got it , What i Have To Do
Thank You So Much @berkus
Really Great community and Great people ;)

from twilio-chat-demo-android.

berkus avatar berkus commented on July 17, 2024

You're welcome :)

from twilio-chat-demo-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.