gpt4 book ai didi

java - "Your package name is not valid"Android 连接到 DEEZER

转载 作者:太空狗 更新时间:2023-10-29 16:41:06 24 4
gpt4 key购买 nike

我正在尝试建立从安卓设备到音乐流媒体平台 deezer 的连接。我遵循了开发人员教程,但一开始就遇到了麻烦。

建立连接工作正常,无论如何日志中没有任何失败。

connection = new DeezerConnectImpl(this, APP_ID);

调用连接进行授权

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

设备模拟器中出现一个新的(神秘的?)屏幕,显示此消息:

enter image description here

我在开发人员页面和互联网上搜索了可能的解决方案,但没有找到任何有用的信息...这个故障是怎么回事..?

完整代码如下:

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

}

错误日志:

enter image description here

这是 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>

最佳答案

  • 进入 deezer 开发者页面
  • 在您注册的APP页面登录,
  • 编辑您的应用程序,您将看到一个“Android 应用程序”在页面上。
  • 将“Android 包名称”设置为 com.example.deezertest2

P.S:Hackitaly,不是吗? :D

关于java - "Your package name is not valid"Android 连接到 DEEZER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17678412/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com