Telegram API发布.keystore错误

6

我尝试在Android Studio中编写Telegram API的一些代码,但首先我只是填写了BuildVars(readme.txt说我必须这样做)。然后运行项目,结果出现了这个错误:

Error:A problem was found with the configuration of task ':TMessagesProj:packageDebug'.
> File 'C:\Users\yanni\Desktop\Telegram-master\TMessagesProj\config\release.keystore' specified for property 'signingConfig.storeFile' does not exist.

我尝试了各种方法,但它仍然无法工作。即使我使用Android Studio中的“构建已签名的APK”选项,并将其安装到手机上,该应用程序仍然会立即关闭。为什么?请帮帮我,对不起我的英语:D。

BUILDVARS:

package org.telegram.messenger;

public class BuildVars {
    public static boolean DEBUG_VERSION = false;
    public static int BUILD_VERSION = 695;
    public static int APP_ID = *****; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
    public static String APP_HASH = "**********"; //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 = "yannick.thespy007@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";
}

GRADLEBUILD:

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:23.1.+'
    compile 'com.google.android.gms:play-services:3.2.+'
    compile 'net.hockeyapp.android:HockeySDK:3.6.+'
    compile 'com.googlecode.mp4parser:isoparser:1.0.+'
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    useLibrary 'org.apache.http.legacy'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    signingConfigs {
        debug {
            storeFile file("config/release.keystore")
            storePassword "bebi22052014"
            keyAlias "Yannick"
            keyPassword "bebi22052014"
         }

        release {
            storeFile file("config/release.keystore")
            storePassword "bebi22052014"
            keyAlias "Yannick"
            keyPassword "bebi22052014"
        }
    }

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

        release {
            debuggable false
            jniDebuggable false
            signingConfig signingConfigs.release
        }

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

    sourceSets.main {
        jniLibs.srcDir 'libs'
        jni.srcDirs = [] //disable automatic ndk-build call
    }

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

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

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

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 695
        versionName "3.3.2"
    }
}

谢谢!

Yannick!

更新:

你好,我已经填写了整个BuildVars:

package org.telegram.messenger;

public class BuildVars {
    public static boolean DEBUG_VERSION = false;
    public static int BUILD_VERSION = 695;
    public static int APP_ID = *****; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
    public static String APP_HASH = "***************************; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
    public static String HOCKEY_APP_HASH = "**************";
    public static String HOCKEY_APP_HASH_DEBUG = "*************";
    public static String GCM_SENDER_ID = "760348033672";
    public static String SEND_LOGS_EMAIL = "yannick.thespy007@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";
}

这是一个常见的错误:

12-21 20:25:22.854 15507-15507/org.telegram.messenger.beta E/art: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
12-21 20:25:22.854 15507-15507/org.telegram.messenger.beta D/AndroidRuntime: Shutting down VM
12-21 20:25:22.855 15507-15507/org.telegram.messenger.beta E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: org.telegram.messenger.beta, PID: 15507
                                                                             java.lang.UnsatisfiedLinkError: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
                                                                                 at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method)
                                                                                 at org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:278)
                                                                                 at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
                                                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4756)
                                                                                 at android.app.ActivityThread.-wrap1(ActivityThread.java)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5466)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

我认为项目必须创建它... Gradle构建说了这个,:D - Yannick - theSpy_007
Gradle构建说了什么?你是什么意思? - njzk2
所以Android Studio不需要创建.keystore文件。Gradle会在此位置查找密钥库文件。您的工作是创建并将其放置在那里。此外,在调试中使用发布密钥库有点令人惊讶。 - njzk2
你太棒了,谢谢!但是出现了一个新的错误,所以应用程序在打开时立即关闭,:D我会在我的问题末尾添加它 :) - Yannick - theSpy_007
你应该为此提出一个新问题。但在此之前,你应该确保你已经阅读了堆栈跟踪信息,理解了它,并在发布新问题之前尝试了明显的解决方案。 - njzk2
显示剩余2条评论
1个回答

4

在 build.gradle 中禁用一些代码

/*  signingConfigs {
    debug {
        storeFile file("config/debug.keystore")
    }

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

buildTypes {
    debug {
        debuggable true
        jniDebuggable true
       // signingConfig signingConfigs.debug
    }

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

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接