M
M
max_vr2016-06-14 15:44:53
Java
max_vr, 2016-06-14 15:44:53

How to initialize vkSDK?

The first time I work with vk SDK, I can't initialize:
VKSdk.initialize(this);
It crashes with the following error:

java.lang.RuntimeException: Unable to start activity ()

Although I launch it from onCreate of the main activity. getApplicationContext doesn't work either

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
viktormarkov, 2016-06-14
@viktormarkov

It is necessary to inherit the Application class and initialize the sdk in its onCreate method

public class App extends Application {
@Override
    public void onCreate() {
        super.onCreate();
        VKSdk.initialize(this);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question