2017-09-15 177 views
0

我使用過Android Studio預覽beta 4版本後,我在報文的源代碼(https://github.com/DrKLO/Telegram)工作,當我想連接到火力地堡我得到這個消息:錯誤:執行失敗的任務「:TMessagesProj:processArmv7DebugGoogleServices」

"Couldnt find keystore in file ({0}) specified for foss build type. {2}"

當我連接手動火力點,並添加谷歌,services.json到我的程序,我得到這個消息

No clients were able to be added to your Firebase project for the following reasons : Firebase: Connect to Firebase failed. Please check your internet connection and try again. If errors persist, you can connect manually at https://console.firebase.google.com

,並得到這個消息

的build.gradle(模塊:TMessengerProj)

apply plugin: 'com.android.application' 

    repositories { 
     mavenCentral() 
    } 

    configurations { 
     compile.exclude module: 'support-v4' 
    } 

dependencies { 
    compile 'com.google.android.gms:play-services-gcm:11.0.2' 
    compile 'com.google.android.gms:play-services-maps:11.0.2' 
    compile 'com.google.android.gms:play-services-vision:11.0.2' 
    compile 'com.google.android.gms:play-services-wallet:11.0.2' 
    compile 'com.google.android.gms:play-services-wearable:11.0.2' 
    compile 'com.android.support:support-core-ui:25.3.1' 
    compile 'com.android.support:support-compat:25.3.1' 
    compile 'com.android.support:support-core-utils:25.3.1' 
    compile 'com.android.support:support-v13:25.3.1' 
    compile 'com.android.support:palette-v7:25.3.1' 
    compile 'net.hockeyapp.android:HockeySDK:4.1.3' 
    compile 'com.googlecode.mp4parser:isoparser:1.0.6' 
    compile 'com.stripe:stripe-android:2.0.2' 
    } 

    android { 
compileSdkVersion 25 
buildToolsVersion '25.0.2' 

useLibrary 'org.apache.http.legacy' 
defaultConfig.applicationId = "org.telegram.messenger" 

sourceSets.main.jniLibs.srcDirs = ['./jni/'] 

externalNativeBuild { 
    ndkBuild { 
     path "jni/Android.mk" 
    } 
} 

dexOptions { 
    jumboMode = true 
} 

compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_7 
    targetCompatibility JavaVersion.VERSION_1_7 
} 

signingConfigs { 
    debug { 
     storeFile file("config/release.keystore") 
     storePassword RELEASE_STORE_PASSWORD 
     keyAlias RELEASE_KEY_ALIAS 
     keyPassword RELEASE_KEY_PASSWORD 
     v2SigningEnabled false 
    } 

    release { 
     storeFile file("config/release.keystore") 
     storePassword RELEASE_STORE_PASSWORD 
     keyAlias RELEASE_KEY_ALIAS 
     keyPassword RELEASE_KEY_PASSWORD 
     v2SigningEnabled false 
    } 
} 

buildTypes { 
    debug { 
     debuggable true 
     jniDebuggable true 
     signingConfig signingConfigs.debug 
     applicationIdSuffix ".beta" 
    } 

    release { 
     debuggable false 
     jniDebuggable false 
     signingConfig signingConfigs.release 
     minifyEnabled false 
     shrinkResources false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 

    foss { 
     debuggable false 
     jniDebuggable false 
     signingConfig signingConfigs.release 
    } 
} 

defaultConfig.versionCode = 1043 

sourceSets.debug { 
    manifest.srcFile 'config/debug/AndroidManifest.xml' 
} 

sourceSets.release { 
    manifest.srcFile 'config/release/AndroidManifest.xml' 
} 

sourceSets.foss { 
    manifest.srcFile 'config/foss/AndroidManifest.xml' 
} 

productFlavors { 
    x86 { 
     ndk { 
      abiFilter "x86" 
     } 
     versionCode = 2 
    } 
    armv7 { 
     ndk { 
      abiFilter "armeabi-v7a" 
     } 
     versionCode = 1 
    } 
    x86_SDK23 { 
     ndk { 
      abiFilter "x86" 
     } 
     sourceSets.debug { 
      manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml' 
     } 
     sourceSets.release { 
      manifest.srcFile 'config/release/AndroidManifest_SDK23.xml' 
     } 
     minSdkVersion 23 
     versionCode = 4 
    } 
    armv7_SDK23 { 
     ndk { 
      abiFilter "armeabi-v7a" 
     } 
     sourceSets.debug { 
      manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml' 
     } 
     sourceSets.release { 
      manifest.srcFile 'config/release/AndroidManifest_SDK23.xml' 
     } 
     minSdkVersion 23 
     versionCode = 3 
    } 
    fat { 
     sourceSets.debug { 
      manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml' 
     } 
     sourceSets.release { 
      manifest.srcFile 'config/release/AndroidManifest_SDK23.xml' 
     } 
     versionCode = 5 
    } 
} 

applicationVariants.all { variant -> 
    def abiVersion = variant.productFlavors.get(0).versionCode 
    variant.mergedFlavor.versionCode = defaultConfig.versionCode * 10 + abiVersion 
} 

defaultConfig { 
    minSdkVersion 16 
    targetSdkVersion 25 
    versionName "4.2.1" 

    externalNativeBuild { 
     ndkBuild { 
      arguments "NDK_APPLICATION_MK:=jni/Application.mk", 
"APP_PLATFORM:=android-14" 
      abiFilters "armeabi-v7a", "x86" 
     } 
    } 
} 
} 

apply plugin: 'com.google.gms.google-services' 

的build.gradle(項目:電報碩士)

buildscript { 
repositories { 
    jcenter() 
    mavenCentral() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.3.2' 
    classpath 'com.google.gms:google-services:3.0.0' 
} 
} 

回答

0
  1. 如果您還沒有準備好,讓AndroidStudio產生 一密鑰存儲與一個關鍵(在我的情況下,我做了一個V2類型) 爲項目使用:構建 - >生成簽名的APK。 請記住密鑰名稱,密鑰庫文件名以及您使用的密碼 !

  2. AndroidStudio(也是java的)提供了一個keytool在 裏面的jre目錄。您必須使用它來提取您剛創建的SHA1 指紋,如下所示: ..... AndroidStudio2.2 \ system \ restart \ jre \ bin \ keytool.exe -exportcert -list -v -alias key_name - 密鑰庫the_keystore.jks 會顯示類似:

    證書指紋: MD5:... SHA1:A2:7E:電子...

  3. 然後你必須去谷歌的火力地堡網頁(*)並註冊該項目。 系統會詢問您的軟件包名稱,如果您還沒有更改 ,應該是:org.telegram.messenger和 您的密鑰中的SHA1。在下面的步驟中,您將與要下載的google-services.json文件一起提供 。 一定要完成嚮導並使其中創建的應用程序。

  4. 將檢索到的文件放入Telegram \ TMessagesProj目錄中。

  5. 返回到AndroidStudio並嘗試使用 以前的相同選項構建項目:構建 - >生成已簽名的APK。

它應該工作。

PS:我發現有時AndroidStudio會鎖定google-services.json,如果發生這種情況,請關閉AndroidStudio。

火力地堡頁:https://console.firebase.google.com

其他資源:https://developers.google.com/android/guides/setup

相關問題