Issue with phonegap local build for android - android

I am trying to build my phonegap app locally and am incountering the following error
[phonegap] adding the Android platform...
Error: Invalid attribute name Line: 0 Column: 36 Char: ?
at error (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/node_modules/sax/lib/sax.js:347:8)
at strictFail (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/node_modules/sax/lib/sax.js:364:22)
at Object.write (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/node_modules/sax/lib/sax.js:876:16)
at XMLParser.feed (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/lib/parsers/sax.js:48:15)
at ElementTree.parse (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/lib/elementtree.js:263:10)
at Object.exports.XML (/usr/lib/node_modules/phonegap/node_modules/cordova/node_modules/elementtree/lib/elementtree.js:593:13)
at Object.module.exports.parseElementtreeSync (/usr/lib/node_modules/phonegap/node_modules/cordova/src/xml-helpers.js:111:38)
at Object.config_parser (/usr/lib/node_modules/phonegap/node_modules/cordova/src/config_parser.js:25:20)
at Object.platform (/usr/lib/node_modules/phonegap/node_modules/cordova/src/platform.js:65:15)
at LocalBuildCommand.module.exports.addPlatform (/usr/lib/node_modules/phonegap/lib/phonegap/local.build.js:153:13)
I am using phonegap 3.0.0

I might be a little late but I just had this problem and solved it.
I just deleted the android folder in 'platforms' and reran
phonegap run android
you can also do phonegap add android if you don't want to run it.
Make sure to back up your xml manifests if you made any changes.

The right way is:
1) $ phonegap platform rm android
2) $ phonegap plaftorm add android
3) $ phonegap build android
It is also recommended to do this when you add or remove plugin.

Related

Error in nativescript-permissions when running android app

My app was running fine and now it is showing me an error which i tried to figure out until now.
ERROR in ../node_modules/nativescript-permissions/permissions.js
Module not found: Error: Can't resolve '#master.technology/permissions' in '/Users/abdull/Desktop/my-app/node_modules/nativescript-permissions'
# ../node_modules/nativescript-permissions/permissions.js 13:17-58
# ../node_modules/#nativescript/imagepicker/index.js
# ./app/shared/image-helper.ts
# ./app/app.module.ts
# ./main.ts
After searching i figured out that i have a plugin "#nativescript/imagepicker": "^1.0.5" which requires "nativescript-permissions": "~1.3.0" in package-lock.json
Migrating from NativeScript 7 to NativeScript 8 fixed the issue for me. To migrate see the link https://v6.docs.nativescript.org/angular/releases/upgrade-instructions
$ tns migrate
After migration, when running the app it might say thar zone.js not found. For that the fix is available at:
https://github.com/manfredsteyer/ngx-build-plus/issues/4
Add
import 'zone.js' in main.ts

Errors when building : no source map reference + remove sentry-cordova exited with exit code 1

I'm trying to build my ionic app for android and most users have a white screen after the splashscreen. I've past the past week to try to determine where it could come but got no idea... So I'm trying to get rid of all the errors I have when building. (it still succed to build with the errors and worked on almost half phones).
First one is here :
Building for Android...
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd plugin remove sentry-cordova exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
> cordova.cmd plugin remove sentry-cordova Sentry: running before_plugin_rm - set SENTRY_SKIP_WIZARD=true to skip this angular.json build.json build_android.sh build-extras.gradle CertificateSigningRequest.certSigningRequest
...
tslint.json www Uninstalling sentry-cordova from android Subproject Path: CordovaLib Subproject Path: app Uninstalling sentry-cordova from browser js-module uninstall called : plugins\sentry-cordova\dist\js\sentry-cordova.bundle.js Uninstalling sentry-cordova from ios Removing "sentry-cordova" Removing sentry-cordova from package.json doc.find is not a function
Second one is after, there is multiples lines like this :
- warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/1-es5.1922
I'm pretty sure I miss some informations. Don't hesitate to ask if necessary but I'm sure I forget to do something, but i'm kinda desperate now...
EDIT : Here is the begining of the script I'm using for build :
echo "Building for Android..."
#npm run android:build:prod
sentryRemove=$(ionic cordova plugin remove sentry-cordova)
echo $sentryRemove
sentryAdd=$(cordova plugin add sentry-cordova)
echo $sentryAdd
echo "successfully added the sentry. \n Performing build now."
appBuildOut=$(ionic cordova build android --prod --release --source-map)
echo $appBuildOut
BUILD_MESSAGE='BUILD SUCCESSFUL'
Thanks for your help
The first question is why are you running a plugin remove command when building your app, if I understand correctly. I would check what is calling this command because the script that is erroring before_plugin_rm should only be called when the plugin is being removed.
To get this script to just work, try running with the environment variable SENTRY_SKIP_WIZARD=true and see if the build works. I don't think the reason for the white screen is related to Sentry as the step that is failing looks to be related to source map uploading.

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

Cordova - module org.apache.cordova.file.File not found

I am developing apps with Cordova.
I have build an app and when calling this in cli cordova run android --device
it's deploying my app on the device. While debugging on chrome I get:
module org.apache.cordova.file.File not found
Why is that ?
In my config.xml file I have the following:
<plugin name="cordova-plugin-file" version="3.0.0" />
and the plugin is located in cordova\platforms\android\platform_www\plugins
The cordova version is 4.1.1.
What is the difference in these below ?
org.apache.cordova.file.File
org.apache.cordova.file
Consolelogs
xxxx.$application::launch()
file:///android_asset/www/resources/ext-watermark/fonts/ext-watermark.woff?n6lnws Failed to load resource: the server responded with a status of 404 (Not Found)
file:///android_asset/www/resources/images/favicon.ico Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/resources/ext-watermark/fonts/ext-watermark.ttf?n6lnws Failed to load resource: the server responded with a status of 404 (Not Found)
app.js:1 ::::Cordova DeviceReady::::
app.js:1 Require: org.apache.cordova.inappbrowser.inappbrowser
app.js:1 Require: org.apache.cordova.file.File
cordova.js:59 Uncaught module org.apache.cordova.file.File not found
For me this issue was arising because of dependent plug-in i.e. org.apache.cordova.media-capture
If you have media-capture plugin installed, you would see inside org.apache.cordova.media-capture.MediaFile.js file there is the file dependent code
var utils = require('cordova/utils'),
exec = require('cordova/exec'),
File = require('org.apache.cordova.file.File'),
CaptureError = require('./CaptureError');
Solution:
I have removed the media-capture plugin for now and looking for an update which doesn't ask for old cordova file plugin API.
cordova plugin rm org.apache.cordova.media-capture
I understand that it wouldn't solve your problem completely, but you should be good to go ahead.
Thanks.
I had the same problem. I saw that although I added a newer version of cordova-plugin-file Cordova still used an older version. Removing /platforms and rerunning cordova platform add android did the trick

./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