How to use phonegap-facebook-plugin in ionic? - android

I'm building an app in ionic/Cordova in which I want my users to be able to log in using Facebook. So I'm trying to install the PhonegapFacebookPlugin that I found on ngCordova.com.
The first thing that I noticed was that the docs on the ngCordova.com website for installing the plugin on Android are different from the docs on the project's github docs. So I first tried using the (simpler) instructions on the github page first, which after installing and trying to use the following code:
facebookConnectPlugin.login(['email'],
function(data){ console.log(JSON.stringify(data));},
function(error){console.log(error);});
led to these errors:
file:///android_asset/www/lib/phonegap-facebook-plugin-master/facebookConnectPlugin.js: Line 181 : Uncaught ReferenceError: require is not defined
file:///android_asset/www/js/app.js: Line 23 : Uncaught TypeError: Cannot read property 'Keyboard' of undefined
file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 19387 : TypeError: Cannot call method 'login' of undefined
at Scope.$scope.fbLogin (file:///android_asset/www/js/controllers.js:10:31)
at $parseFunctionCall (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20124:18)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50863:9
at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22178:28)
at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22276:23)
at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50862:13)
at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10823:21)
at triggerMouseEvent (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2811:7)
at tapClick (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2800:3)
at HTMLDocument.tapTouchEnd (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2918:5)
After running into these errors, I tried continuing with the more extensive installation instructions on the ngCordova website, but the following command:
android update project --subprojects --path "platforms/android" --target android-19 --library "com.phonegap.plugins.facebookconnect/FacebookLib"
led to the following error:
Resolved location of library project to: /Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib
Error: Project folder '/Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib' is not a valid directory.
Error: No Android Manifest at: /Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib
This makes sense, because there is no folder called com.phonegap.plugins.facebookconnect/ in the platforms/android/ folder. I don't really know why not though. Do I need to copy-paste it there? Or did something go wrong in a previous step?
I'm stuck here and I really need to get this working. Any help would be greatly appreciated!

Related

NativeScript Build - Error executing Static Binding Generator: Class not found android.support.v4.view.ViewPager.OnPageChangeListener

I'm new to NativeScript and took over a project recently upgraded from NativeScript 4 to 6. Here is my environment detials:
Windows 10
Node v16.6.1
NativeScript 8.0.2
Android Studio 11 (with al
the recommended updates to date)
VS Code 1.58.2
I can create a new Native script project with "tns create" and build/run it in the simulator just fine. However, when I try to run the project the build throws the following error:
java.lang.RuntimeException: Class not found android.support.v4.view.ViewPager.OnPageChangeListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:551)
at org.nativescript.staticbindinggenerator.Generator.getInterfacesFromCache(Generator.java:534)
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:283)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:171)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:234)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:121)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:55)
Here is the run command I'm using: "tns run android --emulator"
I have tried tons of things and searches but no luck resolving this issue.
So I had an idea and searched with a different search engine than I normally use. I did find some ideas which helped me resolved the issue.
I had previously searched in VSCode for variations on "android.support.v4.view.ViewPager.OnPageChangeListener", but only found the log file with the error. Then I learned you have to change the filter options of the find in file search otherwise the files you are looking for can be excluded from the search results. I also used Baregrep to confirm I was getting everything.
I fixed the issue by replacing all occurrences of:
android.support.v4.view.ViewPager with androidx.viewpager.widget.ViewPager
Also you may need to install widgets:npm i tns-core-modules-widgets
Since the files where I made the changes were all non-project files (many of them in the node_modules directory) there is probably something else that involves updating Node or NativeScript that may solve this as well.
If someone else figures that out, I'll be watching this thread for updates, and thanks in advance!
Fissh

Kotlin native hello world compilation failed on arch linux. UnsatidfiedLinkError: Undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE

I have already compiled this simple example on windows using this https://kotlinlang.org/docs/tutorials/native/using-command-line-compiler.html
Then I tried to set up my arch Linux environment, using this
https://snapcraft.io/install/kotlin-native/arch
while also installing the android sdk from AUR using this,
https://noirscape.github.io/guides/2018/06/14/android-sdk-arch-linux.html
ls gives this - build build.gradle.kts main.kt. README.md settings.gradle.kts src
I am not using gradle for this problem but it is installed
cat main.kt gives this -
fun main() {
println("Hello Kotlin/Native!")
}
when I run kotlinc-native main.kt -o build/hello
I get error: compilation failed: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1:undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
*source files main.kt
*compiler version info: Konan: 0.9.3 / Kotlin: 1.3.0
*Output Kind PROGRAM
exception: java.lang.unsatisfiedLinkError: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1 undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
then there are a lot of at java.base at llvm.llvm and at org.jetbrains.kotlin after that. If those are important I can let me know.
I am a baby kotlin user and a baby Linux user. I believe learning starts from the bottom up so I really want to understand what is happening here instead of just solving it by using gradle or android studios.
I have a feeling that the compiler might not have downloaded all the dependencies on its first run or maybe this has something to do with the symbolic link I made from the first link. please help me understand
ps. I am also sharing a git repo for this project across the two OS's. So maybe this is windows getting in the way but I cant really see how that could be.

Error while compiling Web RTC for Android

I am developing app of video chat in Web RTC.
I am going through documentation of Web RTC.
I have followed all steps mentioned for Getting the Code
export GYP_DEFINES="OS=android"
fetch --nohooks webrtc_android
gclient sync
I have all src code of web rtc in my root directory. As per documentation say we have to compile source to use in our application. Here i got error while compiling source using following command.
$ gn gen out/Default --args='target_os="android" target_cpu="arm"'
ERROR at //build/config/android/internal_rules.gni:636:3: Can't load input file.
import("//third_party/ijar/ijar.gni")
^-----------------------------------
Unable to load:
/Users/c86/webrtc-checkout/src/third_party/ijar/ijar.gni
I also checked in the secondary tree for:
/Users/c86/webrtc-checkout/src/build/secondary/third_party/ijar/ijar.gni
See //build/config/android/rules.gni:8:1: whence it was imported.
import("//build/config/android/internal_rules.gni")
^-------------------------------------------------
See //webrtc/examples/BUILD.gn:12:3: whence it was imported.
import("//build/config/android/rules.gni")
^----------------------------------------
See //BUILD.gn:13:5: which caused the file to be included.
"//webrtc/examples",
^------------------
How can I solve this? Am I going in right direction to develop app of video chat on Web RTC?
Building WebRTC for Android is only supported on Ubuntu(14 / 16).
Currently not supported in macOS.

Deploy Apps with Ionic Package

I figured i would try the 'new' CLI tool for Ionic, Package, but i am getting some weird errors that i haven't seen before.
When running the command :
ionic package build android --profile release
The error i am getting
undefined:0
^
SyntaxError: Unexpected end of input
at Object.parse (native)
at /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/io-config.js:179:28
at fs.js:271:14
at Object.oncomplete (fs.js:107:15)
After some research i found that this can happen when a command is run without sudo, but when running the command with sudo i am getting the dam error message.
Hopefully i am lucky and ill find an Ionic enthusiast who might help me with the matter. Couldn't find any Ionic related topics where this error was mentioned.
Any help appreciated!
I had to add [] to the .io-config.json file in the root directory of my ionic app.
Btw. dont forget to install ionic add ionic-platform-web-client
The solution for me was annoyingly simple. In the file mentioned, find the line where CONFIG_BACKUP is defined and change it. You should see that it is:
var CONFIG_BACKUP = './.io-config.json'
It should actually be:
var CONFIG_BACKUP = './io-config.json'
I was building for iOS but had the same error as you which disappeared after the above.
For me the error resulted from the config.xml file. I would open all ionic files to make sure there are no formatting errors. The rebuild

./create-android-project.sh: line 103: /home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk/tools/android: No such file or directory

I am trying to build project of cocos2dx in my eclipse.whenever I am try to run ./create-android-project.sh command on my terminal its gives me an error saying :-
Now cocos2d-x supports Android 2.2 or upper version
./create-android-project.sh: line 103: /home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk/tools/android: No such file or directory
input target id:
I have made every change as per suggested in this tutorial :- http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started
I have changed the following lines :-
# set environment paramters
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r8d"
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
to
NDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/android-ndk-r10d"
ANDROID_SDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk"
in create-android-project.sh shell script.
have also provided path of my NDK in build_native.sh.
Can anyone tell me that where I am lacking in building this project. Any help will be appreciated. I am working on Ubuntu.
Thanks.

Categories

Resources