CordovaResourceApi import unresolved phonegap - android

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.

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

Error MSB4044 - Getting this error when building Xamarin android project

Error MSB4044: The "ResolveLibraryProjectImports" task was not given a value for the required parameter "DesignTimeBuild"- From visual studio for Mac
Tried cleaning the project and and removed all the obj files.
Any help appreciated.
Thank you
Clean your Project and Build individual Components like right click on your common/Droid/iOs individually and click build,instead of doing build all,see if this works
1.) Check in your Build - Configuration manager that iOS project is not selected while Droid project is being build.
Or
2.) Check the packages version that you have installed are compatible, i.e Xamarin.Forms package version should be compatible with Droid other packages and version should be same for your PCL project.
Hope this may solve your issue.
when I replaced the file with another in the Android.coomon.targets, this error was fixed and the project got build successfully.

Can't mach build Fennec for Android

i'm following this tutorial from firefox android source code https://wiki.mozilla.org/Mobile/Fennec/Android
but, the problem i can't ./mach build, ./mach package, ./mach install and i already create .mozconfig file in mozilla-central but it's can't found the file.
like this:
i'm using Ubuntu 14.04.2
thx for help
You probably had an error during the initial "mach bootstrap" step. Your screenshot tells us, that mach can't find the android sdk tools. It's looking for them under ~/.mozbuild/android-sdk-linux/.
One thing you could do is to manually put your sdk under that directory and then retry "mach bootstrap" from the source dir to resolve the remaining dependencies.
Also see these steps for manual setup of the build tools: https://wiki.mozilla.org/Mobile/Fennec/Android/Detailed_build_instructions

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.

Problems Integrating Phonegap Barcode Scanner for Android

I am trying to get this example project to work: http://simonmacdonald.blogspot.co.uk/2012/10/barcode-scanner-example-projects.html
I have imported both the projects and made the library project a library etc and i have it running but when i run it and click the scan button i get:
Uncaught TypeError: Object [object Object] has no method 'exec' at file://android_asset/www/cordova.js:863
I have changed the target version to 17 (the latest) which allowed me to run it but i cannot seem to get it to work am i missing something?
I would like to run this on my Google Nexus 4 if this info helps.
Here is a zip of all the code i am using: https://dl.dropboxusercontent.com/u/1099165/bc-code.zip
Also i am using Eclipse to run this (ADT)
Because your barcodescanner.js is using old API call. There is no longer cordova.exec. You need to use the latest barcodescanner.js: https://github.com/phonegap/phonegap-plugins/blob/master/Android/BarcodeScanner/2.2.0/assets/www/barcodescanner.js
After Noogen's answer it got me thinking if Cordova needed to be updated so i grabbed the latest phonegap files and replaced the cordova.js file and the 2.8.1 jar file and then did a clean and build - it worked!

Categories

Resources