我正在尝试使用 Branch IO Android SDK,通过引用 branch documentation我创建了一个简单的空白应用程序,并在主 Activity 中实现了 onStart()
方法:
@Override
public void onStart() {
super.onStart();
Branch branch = Branch.getInstance();
branch.initSession(new Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
// params are the deep linked params associated with the link that the user clicked before showing up
Log.i("BranchConfigTest", "deep link data: " + referringParams.toString());
} else {
Log.e("MyApp", error.getMessage());
}
}
}, this.getIntent().getData(), this);
}
通过分支链接打开应用程序后,我在 Android Logcat 上收到此错误:
E/MyApp: Trouble initializing Branch. Unable to reach the Branch servers, please try again shortly.
I/Adreno-EGL: : EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.1.C3__release_AU () OpenGL ES Shader Compiler Version: E031.25.03.06 Build Date: 04/27/15 Mon Local Branch: mybranch9445032 Remote Branch: quic/LA.BF.1.1.1.c3_1 Local Patches: NONE Reconstruct Branch: NOTHING
最佳答案
来自 Branch 的 Alex:如果您的应用没有 INTERNET
,我们通常会看到此错误。配置的权限(有关 Android 开发者门户的更多信息,请参阅 here)。
尝试设置<uses-permission android:name="android.permission.INTERNET" />
在您的 AndroidManifest.xml 中,此错误应该会消失。请参阅here了解如何在我们的演示应用程序中进行设置。
关于android - 错误-Branch IO : Trouble initializing Branch. 无法访问分支服务器,请稍后再试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36068052/