简体   繁体   English

在与DEEZER的Android连接上“您的软件包名称无效”

[英]“Your package name is not valid” on Android connection to DEEZER

I'm trying to establish a connection from an android device to the music-streaming-platform deezer. 我正在尝试建立从android设备到音乐流平台Deezer的连接。 I followed the developers tutorial but already in the beginning there is trouble. 我遵循了开发人员教程,但在开始时就已经遇到了麻烦。

Building the connection works fine, anyway there are'nt any failures in the log. 建立连接正常,无论如何日志中都不会出现任何故障。

connection = new DeezerConnectImpl(this, APP_ID);

On calling the connection to authorize with 在调用连接进行授权时

connection.authorize(this, PERMISSIONS, new ReconnectDialogHandler());

a new (and mysterious?) screen appears in the device-emulator showing this message: 设备模拟器中会出现一个新的(神秘的?)屏幕,显示以下消息:

在此处输入图片说明

I searched on the developers-page and the internet for a possible solution, but i found nothing helpful... What's the matter of this fault..? 我在开发人员页面和互联网上搜索了可能的解决方案,但是我发现没有任何帮助...这个故障是什么问题..?

Here's the complete code: 这是完整的代码:

package com.example.deezertest2;

import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

import com.deezer.sdk.DeezerConnect;
import com.deezer.sdk.DeezerConnectImpl;
import com.deezer.sdk.DeezerError;
import com.deezer.sdk.DialogError;
import com.deezer.sdk.DialogListener;
import com.deezer.sdk.OAuthException;
import com.deezer.sdk.SessionStore;

public class MainActivity extends Activity {

private final String SECRET = "XXXXX";
public String access_token = "XXXXX";
private final String APP_ID = "XXXXX";
private final static String[] PERMISSIONS = new String[] {"basic_access","offline_access"};
private static final String LOG_TAG = "BaseActvt";
DeezerConnect connection;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    StrictMode.enableDefaults();

    System.out.println("onCreate");

    connection = new DeezerConnectImpl(this, APP_ID);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

public void loginButton(View view){
    System.out.println("Button clicked");
    connection.authorize(this, PERMISSIONS, new ReconnectDialogHandler());
}


protected class ReconnectDialogHandler implements DialogListener {

    @Override
    public void onComplete(final Bundle values) {
        SessionStore sessionStore = new SessionStore();
        sessionStore.save( connection, MainActivity.this );
        Toast.makeText( MainActivity.this, R.string.user_authentified, Toast.LENGTH_LONG ).show();
    }//met

    @Override
    public void onDeezerError(final DeezerError deezerError) {
        Toast.makeText( MainActivity.this, R.string.deezer_error_during_login, Toast.LENGTH_LONG ).show();
        Log.e( LOG_TAG, "DialogError error during login" , deezerError );
    }//met

    @Override
    public void onError(final DialogError dialogError) {
        Toast.makeText( MainActivity.this, R.string.deezer_error_during_login, Toast.LENGTH_LONG ).show();
        Log.e( LOG_TAG, "DialogError error during login", dialogError );
    }//met

    @Override
    public void onCancel() {
        Toast.makeText( MainActivity.this, R.string.login_cancelled, Toast.LENGTH_LONG ).show();
    }//met

    @Override
    public void onOAuthException(OAuthException oAuthException) {
        Toast.makeText( MainActivity.this, R.string.invalid_credentials, Toast.LENGTH_LONG ).show();
    }//met


}//inner class

}

And the error-log: 和错误日志:

在此处输入图片说明

Here's the Manifest.xml: 这是Manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.deezertest2"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.deezertest2.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>
  • go on deezer developer page 进入deezer开发人员页面
  • do login go in your registered APP page , 登录后进入您注册的APP页面,
  • edit your application and you will see an "Android application" down on the page. 编辑您的应用程序,您将在页面上看到一个“ Android应用程序”。
  • Set there the "Android Package Name" to com.example.deezertest2 在此处将“ Android包名称”设置为com.example.deezertest2

PS: Hackitaly , isn't it? PS:哈克塔利,不是吗? :D :d

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

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