Add FacebookConnect to cordova in netbeans - android

I'm using cordova with the latest Netbeans build 7.4, which has the cordova integration included.
I added the following line to nbproject/plugins.propteries and can clearly see, that the plugin is fetched:
Calling plugman.fetch on plugin
"https://github.com/phonegap/phonegap-facebook-plugin.git" Fetching
plugin "https://github.com/phonegap/phonegap-facebook-plugin.git" via
git clone
After that, the build crashes, due to missing info:
Error: Variable(s) missing: APP_ID, APP_NAME
Where can I add the missing info, which is the correct file and syntax?

I have found a good tutorial here, which has solved my problem.

Related

MainActivity.java - cannot find symbol reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED)

I've upgraded react-native to latest version (0.68) through react-native CLI, and now every time I'm trying to build for android I get this error:
error: cannot find symbol reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
I tried to clean the bundle, made sure my package name is correct (like others issues suggested) and nothing so far..
If you're using the latest version of React Native (i.e: v >= 68), you've to rebuild your projects. it works for me.
Going through react-native migrations file, I've found out that somehow I missed a few migrations related to react-native new architecture (although I would expect it to be automatic when using react-native CLI upgrade command).
I suggest to follow the migrations changes especially on MainActivity.java and MainApplication.java - don't forget to change the "from" and "to" versions to your case:
https://react-native-community.github.io/upgrade-helper/?from=0.65.1&to=0.68.1

CordovaError: Project name must not begin with a number

I'm building an app which name starts with a number "100 Times". But when I try to add the Android platform:
ionic cordova platform add android
I get the following error:
CordovaError: Error validating project name. Project name must not begin with a number
My config.xml is like:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp.times100" ...>
<name>100 Times</name>
...
</widget>
As far as I know it is not a Google Play restriction, cause there are a lot of apps with names that starts with numbers.
How can I use an application name that starts with a number with Cordova?
I was able to use numbers at beginning of my app name following the steps below:
Create the android studio project running "cordova prepare android"
Open the Android Studio Project and edit "res/values/strings.xml"
Replace the "app_name" node content with the name you want.
Build the APK using Android Studio.
That's a cordova bug. There is an issue for that:
https://github.com/apache/cordova-android/issues/584
There's also a pull request to fix it in version 9.x of cordova-android:
https://github.com/apache/cordova-android/pull/859
For now the only way is to use some (hackish) workaround to fix that.
I generate the apk in a CI environment using docker containers, so executing commands manually in Android Studio was out of question in my case, so I forked the cordova-android repo, commented the lines that does that unnecessary (and wrong) validation and installed the android plugin in my project from the forked github repo.

Getting error cordova.file undefined

As per 'Platform-centered workflow' from https://cordova.apache.org/docs/en/latest/guide/overview/index.html created a project with help of https://github.com/apache/cordova-android repository on local (cordova version: 5.1.0-dev)
Used plugman to add file plug-in into project but getting error cordova.file object is undefined while accessing it in console or alert. cordova object is coming successfully in any dialog box.
Tried with following to solve it but no of use:
github.com/apache/cordova-plugin-file
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-file#4.0.0
All the entries into config.xml file and AndroidManifest.xml are correct after adding any way to add plug-in.
Please suggest anyone to help this.
are you sure cordova.file pluging has added to project ?
if yes, make sure you called cordova.file after device is ready.
document.addEventListener("deviceready", onDeviceReady, false);
and also cordova.file is not working on emulator. (in my experience)

Cannot build project for iOS from cordova cli

I've created a project using Cordova CLI, version 3.5.0.
I've successfully deployed the project for Android platform by using the CLI.
cordova run android
However, I'm having problem to deploy the project for iOS.
cordova run ios
I encountered this error:
mv: dest file already exists: /Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MyPKS-Info.plist
mv: dest file already exists: /Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MyPKS-Prefix.pch
shell.js: internal error
Error: EINVAL, invalid argument '/Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS.xcodeproj'
at Object.fs.renameSync (fs.js:543:18)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:495:8
at Array.forEach (native)
at Object._mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:471:11)
at Object.mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:1491:23)
at pbxProject. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:126:27)
at pbxProject.EventEmitter.emit (events.js:98:17)
at pbxProject. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/xcode/lib/pbxProject.js:30:18)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at handleMessage (child_process.js:322:10)
This problem only occur after I access the Xcode project manually to add the Icon & splash screen since the icon & splash screens are not automatically added to the project even though declared in config.xml.
I've tried to remove the Info.plist & Prefix.pch file, but then this error appeared.
Error: ENOENT, no such file or directory '/Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MYPKS-Info.plist'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object.exports.parseFileSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/plist-with-patches/lib/plist.js:18:19)
at Object.module.exports.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:66:31)
at Object.module.exports.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:189:21)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:113:31
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
The project works just fine if launched from Xcode, but I no longer can build the project from CLI or launch the "serve" command from CLI for debugging purpose.
Please guide me, thanks.
SOLVED
Solved by renaming the project name using Xcode. Thanks Jason for the tips.
Just remove the platforms and then add them again.
cordova platform rm ios
cordova platform rm android
cordova platform add ios
cordova platform add android
EDIT: Try this other solution first! It works for most issues: https://stackoverflow.com/a/28300528/1250444
I struggled with this as well. Finally found a solution by trial and error. D:
What happened for me was renaming the project name to have capitals. This caused all sorts of confusion for Cordova.
The first thing I did was rename the problematic plist and pch files to match the correct capitalization. So, in your case, if it was myPKS, but now is MyPKS, you'd need to rename the files to be MyPKS-Info.plist and MyPKS-Prefix.pch.
I then had to rename the .xcodproj to match capitalization.
After that, another issue happened:
xcodebuild: error: The project 'NewName.xcodeproj' does not contain a target named 'NewName'.
To solve this, I had to rename the target to have the proper capitalization as well. Since I'm new to iOS dev, I have not idea how to describe how to get there. I just finally stumbled upon it, made the change, and it worked!
Best of luck!
What solved my problem was by doing the following
Removing the ios platform; ionic platform remove ios
Removing the android platform; ionic platform remove android
Adding the Ios platform back; ionic platform add ios
Adding the android platform back; ionic platform add android
Rebuild; ionic build
Hope this helps anyone else.
Jason Cox's answer helped me - but I did not rename any files, I just had to change the name of the app in my config.xml
<name>myApp</name>
to
<name>MyApp</name>
This worked in Meteor 1.3.x
Remove a particular platform and re-add again via meteor command via console.
For ex.
meteor list-platforms
meteor remove-platform ios
meteor add-platform ios
I got this same error. The reason why this happen to me was because i changed the name in the xml from myapp to MyApp. It worked again once i changed it back to the old name.
Renaming in xcode also worked so thanks for that.

CordovaResourceApi import unresolved phonegap

I am using phonegap-2.9.0 with file plugin. When I build project for android platform it creates two packages within the src/ folder:
org.apache.cordova.file
org.apache.cordova.filetransfer
I get below errors within these two packages:
1 - org.apache.cordova.file.FileUtils
Method testSaveLocationExists() from the type DirectoryManager is not visible
Method getFreeDiskSpace() from the type DirectoryManager is not visible
Method testFileExists() from the type DirectoryManager is not visible
2 - org.apache.cordova.filetransfer.FileTransfer
import org.apache.cordova.CordovaResourceApi unresolved
import org.apache.cordova.CordovaResourceApi.OpenForReadResult unresolved
Could someone please tell me what I should do to resolve these?
Thanks.
You have two problems.
1) Version of Phonegap is outdated
2) The way to install a plugin is:
-> phonegap plugin add "urlofplugin" or "/path""
-> phonegap platform add android
-> phonegap prepare
-> phonegap build
sometimes the plugin has a different default installation, the files need to change the platform.
Well, I dont know if I can help you, but I had similar problems. When I installed exactly those two plugins I got an error too. A different one, which I dont perticularly remember, something to do with a missing file that I can easily find in the file manager. Anyway, what helped me was:
I updated to a more recent version, if you are able to I advice for it.
After installing the plugins through cordova cmd api (.nodejs command prompt ... you know what I mean) I was forgetting to build in the api itself. It sounds stupid but I was using wp8 and thus using a template for visual studio. The studio gave me the error, the building process (in cmd) also gave errors, but it was fixed by updating to the newer version.
You need to configure you build path and then add library from external source and select the library then it will resolve or u can make copy and paste cordova library .jar file in your lib folder. then it will remove, if not happen then tell me .......
I am not sure if that will work but first uninstall these plugins using phonegap/cordova CLI and than reinstall it in the root of application folder using the CLI only like this:
phonegap local plugin add <required plugin>
This worked for me after reinstallation.

Categories

Resources