错误:必须在AndroidManifest.xml中设置有效的Facebook应用程序id



我关注这个视频。这个应用程序我运行在移动设备小米红米4A。安装成功并显示此错误。我不明白为什么?我不能在此代码中使用Facebook。

错误:

已成功在设备上同步应用程序org.nativescript.pushnotify8066aa497d24.活动管理器:启动进程26158:org.nativescript.pushnotify/u0a238用于活动org.nativeescription.pushnotify/com.tns.NativeScriptActivity调用者=null07-06 12:21:32.247 26158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethodNative(Native Method)07-06 12:21-32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)07-0612:21:32.247 26158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethodImpl(Runtime.java:983)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:970)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:954)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:946)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethodNative(Native Method)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)07-0612:21:32.247 26158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethodImpl(Runtime.java:983)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:970)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:954)07-06 12:21:32.24726158 26158 E AndroidRuntime:
com.tns.Runtime.callJSMethod(Runtime.java:946)07-06 12:21:32.24726158 26158 E AndroidRuntime:位于com.tns.Runtime.callJSMethodNative(Native Method)07-06 12:21:32.24726158 26158 E AndroidRuntime:位于com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)07-0612:21:32.247 26158 26158 E AndroidRuntime:在com.tns.Runtime.callJSMethodImpl(Runtime.java:983)07-06 12:21:32.24726158 26158 E AndroidRuntime:位于com.tns.Runtime.callJSMethod(Runtime.java:970)07-06 12:21:32.24726158 26158 E AndroidRuntime:位于com.tns.Runtime.callJSMethod(Runtime.java:954)07-06 12:21:32.24726158 26158 E AndroidRuntime:位于com.tns.Runtime.callJSMethod(Runtime.java:946)System.err:java.lang.RuntimeException:无法启动活动组件信息{org.nativescript.pushnotice.com/tns.NativeScriptActivity}:com.tns.NativeScriptException:System.err:在Create上调用js方法失败System.err:System.err:错误:有效的Facebook应用id必须为在AndroidManifest.xml中设置,或通过调用初始化sdk之前的FacebookSdk.setApplicationId。系统错误:com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:276)系统错误:
com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:232)System.err:com.tns.Runtime.callJSMethodNative(本机方法)System.err:
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)System.err:com.tns.Runtime.callJSMethodImpl(Runtime.java:983)System.err:com.tns.Runtime.callJSMethod(Runtime.java:970)System.err:com.tns.Runtime.callJSMethod(Runtime.java:954)System.err:com.tns.Runtime.callJSMethod(Runtime.java:946)System.err:
com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)System.err:android.app.Activity.performCreate(Activity.java:6875)System.err:
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)System.err:
android.app.ActivityThread.performLaunchActivity(ActivityThreads.java:2659)System.err:
android.app.ActivityThread.handleLaunchActivity(ActivityThreads.java:2767)System.err:
android.app.ActivityThread.-wrap12(ActivityThreads.java)System.err:
android.app/ActivityThread$H.handleMessage(ActivityTthread.java:1514)System.err:android.os.Handler.dispatchMessage(Handler.java:102)System.err:android.os.Looper.loop(Looper.java:163)System.err:
android.app.ActivityThread.main(ActivityThread.java:6221)System.err:java.lang.reflect.Method.ioke(Native Method)System.err:
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)系统错误:
com.android.internal.os.ZygoteInit.main(ZygoteNit.java:794)System.err:文件:"文件:///data/data/org.natidescript.pushnotify/files/app/tns_modules/nativedescript-plugin-firebase/firebase.js,行:331,列:41 System.err:System.err:StackTrace:System.err:帧:函数:'runInit',file:'file:///data/data.org/nativescript.pushnotice/files/app/tns_modules/nativescript-plugin-firebase/firebase.js',行:331,列:42系统错误:帧:函数:"Observable.notify",file:'file:///data/data.org/nativescript.pushnotice/files/app/tns_modules/tns core-modules/data/obsobservable/observable.js',行:110,列:23 System.err:帧:函数:'notifyLaunch',文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:870,列:17系统错误:帧:函数:"ActivityCallbacksImplementation.setActivityContent",文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:803,列:28系统错误:帧:函数:"ActivityCallbacksImplementation.onCreate",文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:677,列:14系统错误:帧:函数:'NativeScriptActivity.onCreate',文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/activity.js',行:20,列:25 System.err:System.err:位于android.app.ActivityThread.performLaunchActivity(ActivityThreads.java:2706)System.err:位于android.app.ActivityThread.handleLaunchActivity(ActivityThreads.java:2767)System.err:位于android.app.ActivityThread.-wrap12(ActivityThreads.java)System.err:
位于android.app.ActivityThread$H.handleMessage(ActivityThreads.java:1514)System.err:位于android.os.Handler.dispatchMessage(Handler.java:102)System.err:
在android.os.Looper.loop(Looper.java:163)System.err:atandroid.app.ActivityThread.main(ActivityThreads.java:6221)System.err:位于java.lang.reflect.Method.ioke(Native Method)System.err:处com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)System.err:位于com.android.internal.os.ZygoteInit.main(ZygoteNit.java:794)System.err:由com.tns.NativeScriptException引起:System.err:调用js方法onCreate失败System.err:System.err:错误:A必须在AndroidManifest.xml中设置有效的Facebook应用程序id,或由在初始化sdk之前调用FacebookSdk.setApplicationId。系统错误:
com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:276)系统错误:
com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:232)System.err:com.tns.Runtime.callJSMethodNative(本机方法)System.err:
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)System.err:com.tns.Runtime.callJSMethodImpl(Runtime.java:983)System.err:com.tns.Runtime.callJSMethod(Runtime.java:970)System.err:com.tns.Runtime.callJSMethod(Runtime.java:954)System.err:com.tns.Runtime.callJSMethod(Runtime.java:946)System.err:
com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)System.err:android.app.Activity.performCreate(Activity.java:6875)System.err:
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)System.err:
android.app.ActivityThread.performLaunchActivity(ActivityThreads.java:2659)System.err:
android.app.ActivityThread.handleLaunchActivity(ActivityThreads.java:2767)System.err:
android.app.ActivityThread.-wrap12(ActivityThreads.java)System.err:
android.app/ActivityThread$H.handleMessage(ActivityTthread.java:1514)System.err:android.os.Handler.dispatchMessage(Handler.java:102)System.err:android.os.Looper.loop(Looper.java:163)System.err:
android.app.ActivityThread.main(ActivityThread.java:6221)System.err:java.lang.reflect.Method.ioke(Native Method)System.err:
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)系统错误:
com.android.internal.os.ZygoteInit.main(ZygoteNit.java:794)System.err:文件:"file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/nativescript-plugin-firebase/firebase.js,行:331,列:41 System.err:System.err:StackTrace:System.err:帧:函数:'runInit',文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/nativescript-plugin-firebase/firebase.js',行:331,列:42系统错误:帧:函数:"Observable.notify",文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/data/observable/observable.js',行:110,列:23 System.err:帧:函数:'notifyLaunch',文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:870,列:17系统错误:帧:函数:"ActivityCallbacksImplementation.setActivityContent",文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:803,列:28系统错误:帧:函数:"ActivityCallbacksImplementation.onCreate",文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/frame.js',行:677,列:14系统错误:帧:函数:'NativeScriptActivity.onCreate',文件:'file:///data/data/org.nativescript.pushnotify/files/app/tns_modules/tns-core-modules/ui/frame/activity.js',行:20,列:25 System.err:System.err:位于com.tns.Runtime.callJSMethodNative(Native Method)System.err:位于com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1101)System.err:在com.tns.Runtime.callJSMethodImpl(Runtime.java:983)System.err:在com.tns.Runtime.callJSMethod(Runtime.java:970)System.err:在com.tns.Runtime.callJSMethod(Runtime.java:954)System.err:在com.tns.Runtime.callJSMethod(Runtime.java:946)System.err:位于com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:18)System.err:位于android.app.Activity.performCreate(Activity.java:6875)System.err:
位于android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)System.err:位于android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)系统错误:。。。9更多System.err:原因:一个有效的Facebook应用程序id必须在AndroidManifest.xml中设置,或者通过调用初始化sdk之前的FacebookSdk.setApplicationId。系统错误:在com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:276)System.err:位于com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:232)系统错误:。。。19更多ActivityManager:报告终止过程:killerPid:26158,killedPid:26158ActivityManager:Processorg.nativescript.pushnotify(pid 26158)已死亡:fore TSActivityManager:cleanUpApplicationRecord--26158

你能问我一些想法吗?如何解决这个问题?

您的AndroidManifest应包含此行<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

以下是部分AndroidManifest.xml,其中包含

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="10017"
android:versionName="1.17">
...
<application android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme">
...
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>
</manifest>

在您的App_Resources/Android/src/main/res/values/strings.xml中,设置以fb开头的facebook应用程序ID

<resources>
...
<string name="facebook_app_id">fb{{ facebook_app_id }}</string>
</resources>

最新更新