Open Absant94 opened 4 years ago
Execute these commands:
mkdir -p platforms/android/app/src/main/res/mipmap
cp resources/icon.png platforms/android/app/src/main/res/mipmap
cp resources/splash.png platforms/android/app/src/main/res/mipmap
Execute these commands:
mkdir -p platforms/android/app/src/main/res/mipmap cp resources/icon.png platforms/android/app/src/main/res/mipmap cp resources/splash.png platforms/android/app/src/main/res/mipmap
Hi! Thanks! Now the app "build" but launch a "defaultErrorLogger" , so the app is installed but is blank .And before install the plugin it was working. Am i doing something wrong?
With this fix I was able to build, but...
Is there any way to resolve this without digging in the platform-specific folders?
Also, how is this specific to this plugin (if it now is)?
If it is, could it be fixed once and for all by updating the plugin?
Thanks in advance.
I already posted the solution here https://github.com/apache/cordova-android/issues/678#issuecomment-574714031
Is not a good practice to touch the files inside platforms> (edit or create stuff there), so I recommend to change the ICON variable and keep it like
<plugin name="@mauron85/cordova-plugin-background-geolocation" spec="3.0.3"> ... <variable name="ICON" value="@mipmap/ic_launcher" /> ... </plugin>
This route "mipmap/ic_launcher" will work. BTW now package is @mauron85/cordova-plugin-background-geolocation, the other one is deprecated
Just to complement the answer from @ZumelzuR :
You can also change this configuration in your package.json
:
// package.json
{
"cordova": {
"plugins": {
"@mauron85/cordova-plugin-background-geolocation": {
"ICON": "@mipmap/ic_launcher", // <-- Change this to 'ic_launcher'
"SMALL_ICON": "@mipmap/ic_launcher", // <-- Change this to 'ic_launcher'
},
},
},
}
After hours trying to solve this problem, my DEFINITIVE solution that worked fine (without touch the files inside platforms), was:
1º - run cordova platform remove android
2º - Added this line in my config.xml inside the tag <platform name="android">
<resource-file src="resources/android/icon/drawable-xxxhdpi-icon.png" target="app/src/main/res/mipmap/icon.png" />
3º - Update the plugin settings inside config.xml
<plugin name="@mauron85/cordova-plugin-background-geolocation" spec="3.1.0">
<variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11+" />
<variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="26+" />
<variable name="ICON" value="@mipmap/icon" />
<variable name="SMALL_ICON" value="@mipmap/icon" />
<variable name="ALWAYS_USAGE_DESCRIPTION" value="App requires background tracking " />
<variable name="MOTION_USAGE_DESCRIPTION" value="App requires motion detection" />
</plugin>
4º - Configure my package.json
// package.json
{
"cordova": {
"plugins": {
"@mauron85/cordova-plugin-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "@mipmap/icon",
"SMALL_ICON": "@mipmap/icon",
"ACCOUNT_NAME": "@string/app_name",
"ACCOUNT_LABEL": "@string/app_name",
"ACCOUNT_TYPE": "$PACKAGE_NAME.account",
"CONTENT_AUTHORITY": "$PACKAGE_NAME"
},
},
},
}
5º - Last step run cordova platform add android
IONIC VERSION: 6.4.0 CORDOVA VERSION: 9.0.0 (cordova-lib@9.0.1) NODE VERSION: v10.16.0
I am new to both Android and Cordova plugins, but I wanted to try it for a Quasar app. I am not sure if I am right, but my impression is that there is very little amount of serious Cordova plugin development anymore...? Seems like there is a lot of abandoned forks, that people have moved on except for a few "bumped version" pushes, and many plugins seem to be slowly dying... I wanted to give this plugin a try, but I ran into the same error as described here... I have tried all the described solutions, but I am still getting an error: "Source path does not exist: resources/android/icon/drawable-xxxhdpi-icon.png".
But are these solutions just workarounds, and is this a real bug that should be solved in the plugin? (because from reading these comments I find it hard to tell where the real problem lies)
Yeah, I know what you mean @w-a-b . I don't think it's a real bug, I think that many of us do not fully understand the structure of a Gradle project and its integration with Cordova, as well as how to successfully use the configuration options for the stack.
It's been a couple of months since my last Cordova project so my memory is getting blurry and I don't have a concrete example to show or to give you a solution, but from what I get is that the path to the icon file will depend on the file structure that your Gradle project generates. I wouldn't be surprised if it changed from one framework to another or even from one version to another. If this fix works for Ionic I don't know whether it will work for Quasar.
I agree with you @w-a-b . I'm not an expert with Android and Cordova. But maybe you can try again the solution and change the Source path "resources/android/icon/ICON_NAME". I don't know how Quasar works, but after the framework builds the app, probably it will generate some files to "resources/android/icon" there you need to find the file that is your icon and then, change the Source path for your correct file name.
I think you @w-a-b are on the right way, just need to make a small change for this to work.
@RaschidJFR , @Ircampos97, thank you guys, I appreciate it and will give it a try. Plan B is to buy a cordova-background-geolocation-lt license, even if it seems to be a bit overkill for my needs.
@lrcampos97 's solution worked for me.
Please update this as a fix, it is ridiculous that we cannot compile until manual fix this bug.
Mi solución fue armar un Hook que copie uno de mis iconos en la carpeta pedida y con el nombre adecuado.
var fs = require('fs');
var path = require('path');
var rootdir = context.opts.projectRoot;
var srcfile = path.join(rootdir,"resources/android/icon_notificacion/drawable-hdpi/icon.png");
var destfile = path.join(rootdir,"platforms/android/app/src/main/res/mipmap/icon.png");
fs.createReadStream(srcfile).pipe(fs.createWriteStream(destfile));
Add the following line to the android platform in config.xml:
<resource-file src="resources/android/icon/drawable-xxxhdpi-icon.png" target="app/src/main/res/mipmap/icon.png" />
All I had to do to resolve this was add ICON
and SMALL_ICON
variables to the plugin add command line. Didn't need to copy any icon resource as @mipmap/ic_launcher
already exists.
cordova --save plugin add @mauron85/cordova-plugin-background-geolocation \
--variable GOOGLE_PLAY_SERVICES_VERSION="+" \
--variable ANDROID_SUPPORT_LIBRARY_VERSION="$ANDROID_SUPPORT_LIBRARY_VERSION" \
--variable ALWAYS_USAGE_DESCRIPTION="$ALWAYS_USAGE_DESCRIPTION" \
--variable ICON="@mipmap/ic_launcher" \
--variable SMALL_ICON="@mipmap/ic_launcher"
Im using this plugin on my app, but when I use it on a page, all the times throws this error.
Your Environment
Cordova plugin list:```
Steps to Reproduce
1.sudo ionic cordova run android 2. 3. 4.
Context
I want to use background geolocation to follow my movements durin a period of time
Debug logs