fudom commented on issue #1731:
URL: 
https://github.com/apache/cordova-android/issues/1731#issuecomment-2277275856

   Yes, as I wrote, this is my workaround:
   
   ```js
   if (!existsSync('platforms/android/android.json')) {
     const cordovaAndroidVersion = devDependencies['cordova-android'];
     execSync(`cordova platform add android@${cordovaAndroidVersion}`, { stdio: 
'inherit' });
   }
   ```
   
   This works in most cases. But sometimes I get the following error:
   
   ```
   CordovaError: Platform android already added.
     at 
C:\path-to-app\node_modules\cordova-lib\src\cordova\platform\addHelper.js:120:35
   ```
   
   Especially, when I try this on a fresh cloned repo. And when this error 
happens and you build again, the build will not include all plugins etc. but 
there is no error. It just build successfully the half app. We had some cases 
of incomplete app builds.
   
   I could remove the platform first, and than add again. But I wonder, why 
Cordova is not ensuring this since, it should know the platforms from e.g. 
package.json:
   
   ```json
   {
     "cordova": {
       "plugins": {"...": {}},
       "platforms": [
         "android"
       ]
     }
   }
   ```
   
   And I wonder why incomplete builds are possible. It seems Cordova does not 
ensure all platforms and plugin data are complete. This is also specified in 
package.json cordova node.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to