简体   繁体   English

ScoreloopUI->找不到源

[英]ScoreloopUI -> Source is not found

I want to add Scoreloop in my App. 我想在我的应用程序中添加Scoreloop。 I tried it with the official tutorial, but after I wrote my game secret (like the special ID for this site) in the code, eclipse has this problem: "Source not found" 我使用官方教程进行了尝试,但是在代码中写下了我的游戏机密(例如该站点的特殊ID)后,eclipse出现了以下问题:“找不到源”

This is my Application Code: 这是我的应用代码:

Edit: 编辑:

Good. 好。

I changed the code. 我更改了代码。 Scoreloop is saying (The tutorial): This code should work. Scoreloop在说(本教程):此代码应该有效。 The file exist. 该文件存在。 But it's still not working. 但是它仍然无法正常工作。

package com.example.littlepigs;

import android.app.Application;

import com.scoreloop.client.android.ui.ScoreloopManagerSingleton;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ScoreloopManagerSingleton.init(this,
                "SAGk1GZeD3hqJOoThZTWM3YlCFuvgAdZrGgjU6TSCecUw1FnNCJDhw==");
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        ScoreloopManagerSingleton.destroy();
    }

}

There is also https://stackoverflow.com/questions/10214659/implementing-scoreloop-on-android?rq=1 Which you should take a look at as it's very similar to yours. 还有https://stackoverflow.com/questions/10214659/implementing-scoreloop-on-android?rq=1,您应该看看它,因为它与您的非常相似。

First let's fix the class, you should extend Application not Android.app.Application. 首先让我们修复该类,您应该扩展Application而不是Android.app.Application。

Fix this and copy me the error you get in LogCat have you already create a class called Application that you are extending or is it a base android class? 修复此问题,然后将您在LogCat中遇到的错误复制给我,是否已经创建了要扩展的名为Application的类,或者它是基本的android类?

package com.example.littlepigs;

import com.scoreloop.client.android.ui.ScoreloopManagerSingleton;

public class Application extends Application //not android.app.Application {
    @Override
    public void onCreate() {
            super.onCreate();
            ScoreloopManagerSingleton.init(this, "secret");
    }

@Override
public void onTerminate() {
        super.onTerminate();
        ScoreloopManagerSingleton.destroy();
}

} 

You also don't need to import context, context is saying "what am I doing this as?" 您也不需要导入上下文,上下文说“我在做什么?” So when you pass 所以当你通过

ScoreloopManagerSingleton.init(this, "secret");

You are really saying "Start a new ScoreLoopManagerSingleton as Application1" 您实际上是在说“作为Application1启动一个新的ScoreLoopManagerSingleton”

context is saying "who am I doing this as?" 上下文在说“我是谁?”

ScoreloopManagerSingleton.init(this(which would mean Application1's context), "secret") ScoreloopManagerSingleton.init(this(这意味着Application1的上下文),“秘密”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM