ionic 3 Error : when commend run
cordova platform add android --save × Running command - failed! [WARN] Platform already added. Saving platforms to config.xml. Platform android is not installed! Would you like to install it? (Y/n)
and when i try run
cordova run android shown Error: Source path does not exist: resources/android/icon/drawable-hdpi-icon.png
ionic cordova platform add android
Platform android is not installed! Would you like to install it? (Y/n) press Y
Please remove any preference with portrait/landscape from your config.xml file before adding platform .
Solution
Step 1 : Remove android platform
ionic cordova platform rm android
Step 2 :check config.xml if android platform array is there, if it is still there remove it.
Step 3 : Add android platform again
ionic cordova platform add android
Step 4 : Run ionic on android
ionic cordova run android -l -c
step 5 : genrate resource files for platform details here
ionic cordova resources android
Firstly you need to run the command:
ionic cordova resources android
It creates all the various size images based of a default you supply, adding lines to config.xml for build to use later in generation of the APK.
More info on the size can be obtained here .
icon.png 1024px x1024px - you supply this.
splash.png 2732px x 2732px
The source image for icons should ideally be at least 1024×1024px and located at resources/icon.png . The source image for splash screens should ideally be at least 2732×2732px and located at resources/splash.png .
...
Then follow up with the build:
ionic cordova build android --prod
As others have indicated it may be prudent to remove/add platform again to be sure.
ionic cordova platform rm android
ionic cordova resources android
ionic cordova platform add android
Android Studio:
If you continue to have issues. Run:
ionic info
And paste output into your question as well.
UPDATED to reflect comments below:
I would presume your config.xml is somehow hosed .
There is a section in it which associates icon and splashscreen.
This is what I have in mine for the android platform part.
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
This part gets injected into the code by the
ionic cordova resources android
If you have src locations that don't relate to real artwork of icons/splashscreens then you are likely to get the error. Try manually deleting everything between:
<platform name="android">
....
</platform><!-- The one relating to android! -->
Then rerun from the top until the update section.
If all else fails, there may be more issues with the config.xml, in which case you could take more drastic actions...
If I am not around later to answer...
ionic cordova plugin add cordova-plugin-inappbrowser@latestcordova-plugin-inappbrowser@latest
This incidentally adds these nodes to the config.xml
<plugin name="..." spec="..." />
manually update these again too.
In the meantime, at the os level delete the platforms folder from your original app project folder,
Let me know if it helps.
在您的 xml 配置中,您应该相应地指定引擎
<engine name="android" spec="7.1.4" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.