参考此处询问的电报集成My Previous Question ,我已将电报主项目源代码从GitHub导入我的Android Studio IDE GitHub Link
第一次运行后,显示所需的google-services.json文件错误,如图1 所示 "模块根文件夹中缺少文件google-services.json。如果没有它,Google Services插件将无法正常运行。
有些文件的变化如电报官方网站所述。 APP_ID& APP_HASH已根据我的电报帐户联系电话号码进行了更新。
BuildVars.java
/*
* This is the source code of Telegram for Android v. 3.x.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2016.
*/
package org.telegram.messenger;
public class BuildVars {
public static boolean DEBUG_VERSION = false;
public static int BUILD_VERSION = 851;
public static String BUILD_VERSION_STRING = "3.13";
public static int APP_ID = *22**; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
public static String APP_HASH = "01a66ec**********ea979**********"; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
public static String HOCKEY_APP_HASH = "your-hockeyapp-api-key-here";
public static String HOCKEY_APP_HASH_DEBUG = "your-hockeyapp-api-key-here";
public static String GCM_SENDER_ID = "760348033672";
public static String SEND_LOGS_EMAIL = "email@gmail.com";
public static String BING_SEARCH_KEY = ""; //obtain your own KEY at https://www.bing.com/dev/en-us/dev-center
public static String FOURSQUARE_API_KEY = ""; //obtain your own KEY at https://developer.foursquare.com/
public static String FOURSQUARE_API_ID = ""; //obtain your own API_ID at https://developer.foursquare.com/
public static String FOURSQUARE_API_VERSION = "20150326";
}
已下载google-servives.json文件(从此处link下载) 在这样做的时候,我给了应用名称 TMessagesProj &包名称为 com.telegram 。我在问SHA Key。
生成Keystorefile.jks后,我从命令提示符处获得了SHA1 Key。最后,我得到了google-servives.json
谷歌servives.json
{
"project_info": {
"project_number": "9063***82727",
"project_id": "tmessagesproj-767a5"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:906349682727:android:31bf726991d01aca",
"android_client_info": {
"package_name": "org.telegram"
}
},
"oauth_client": [
{
"client_id": "906349682727-vcvhs6liiqgfdfc90vasor1vf9cfsqrp.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.telegram",
"certificate_hash": "11D45CD77CC61E236233BD1A2FB74A0BE1184C15"
}
},
{
"client_id": "906***682727-n0finerekh0ajii3qr4dqm0rd8fnl4ck.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAqyKxdPU4mcDElWWHnJXuOwTtz_JP****"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}
在应用中添加google-services.json文件,即TMessagesProj 后,会出现错误,如图2所示
有人可以告诉我哪里出错了吗?在下载json文件时给出包名是否有任何错误?
答案 0 :(得分:1)
填写BuildVars.java文件
标签BuildsVariants编辑armv7Debug - > armv7Release