1. Mô tả vấn đề
Khi sử dụng “cordova-plugin-facebook4” để thực hiện chức năng đăng nhập mặc dù đã khai báo APP_ID và APP_NAME trong file config.xml như thế này:
<plugin name="cordova-plugin-facebook4" spec="^2.0.0">
<variable name="APP_ID" value="ID Ứng dụng đã đăng ký trong developers facebook" />
<variable name="APP_NAME" value="Tên ứng dụng đã đăng ký trong developers facebook" />
<variable name="ANDROID_SDK_VERSION" value="4.+" />
</plugin>
Nhưng khi build vẫn xuất hiện lỗi như dòng đen ngòm bên dưới (“fb_app_id) not found“, “fb_app_name) not found“):
2. Giải quyết vấn đề
Để khắc phục lỗi này, chúng ta mở file config.xml, trong thẻ <platform name=”android”> chúng ta thêm đoạn cấu hình sau:
<platform name="android">
<config-file parent="/resources" target="./res/values/strings.xml">
<string name="fb_app_id">ID Ứng dụng đã đăng ký trong developers facebook</string>
<string name="fb_app_name">Tên ứng dụng đã đăng ký trong developers facebook</string>
</config-file>
Nosomovo