how to resolve installation problem in device ionic 4 - ionic-framework

I'm trying install .APK in my divece but I get the following error "app was not installed", I'm using ionic v 4 and my divece is android 6.0.1, any idea ?

Use this command for V4 :
ionic cordova build --release android
This will generate unsigned apk file under
platforms/android/build/outputs/apk/your-project-name.apk
And simply download apk file to your phone and install it. More details can be found here

I faced this error before and the cause was that using unsigned APK or the device contains app with same "App Id"
So to Solve it, Please Follow this instructions:
Use this Command
ionic cordova build android --prod
Then Try to remove any other apps from your phone that may have same app id (any old versions or sample apps) or change your app id from config.xml (before build of course)
<widget id="com.android.YOUR_UNIQE_APP_ID" ... >

Related

Issue when I use ionic cordova run android

I am getting an issue when I try to run with command line
ionic cordova run android
The error that it diplays is this one:
ERR_NO_TARGET: No targets devices/emulators available. Cannot create AVD because there is no suitable API installation. Use --sdk-info to reveal missing packages and other issues.
But the thing is that I created a device in the Android Studio:
so I wonder what could the problem be? Thanks
You need to launch the emulator and keep it running before executing the command ionic cordova run android
Click on the Play icon in the Virtual Devices list to launch the emulator.
Might not be the answer you're looking for but generally, I use:ionic cordova build android
Then open the platform/android directory in Android Studio.
Maybe you should try this :
for see avaliables devices this:
ionic cordova run android --list
for run android app on device this:
ionic cordova run android --device --verbose
i hope help you.
Make sure you have the following variables set in your environment.
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_AVD_HOME=$HOME/.android/avd

Ionic 4: Issue building for device

Error when building for the device
I am getting an error when I try to build for the device(ionic cordova run android --device). For some reason it is not creating platforms/android/app/build/outputs/apk/debug/app-debug/apk. I have tried removing and adding android different versions. Also, I have tried ionic cordova run android --no-native-run and it loads but with a blank screen.
I found 2 solutions, so if you have a problem with running the device feature:
Update CLI!
Remove Android
ionic cordova platform rm android
Add android#6 and run ionic cordova run android --no-native-run
OR
3.add the latest android#latest and run ionic cordova run android.
Those two worked for me, depending on the version of your projects!

How to get .apk and .ipa file from flutter?

I am new to flutter programming and I've created a demo app, its running fine on both android and iOS devices. I want to see .apk and .ipa file in flutter. Can anyone help me to get these files from Flutter? Where can I see these files in folders or is there any other solution.
For apk (Android) you need to run the command :
flutter build apk --release
If you want to split the apks per abi (Split Apk) then run
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
For ipa (iOS) you need to run the command :
flutter build ios --release
From the console
P.S. --release is optional as it is by default
if you need debug build, just replace --release with --debug
you can find the released APK or IPA files form
build/app/outputs/flutter-apk/app-release.apk
For Android an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk. If you want a release APK, have a look at the docs.
I'm not an iOS person, so I'm not sure an IPA is generated during development as in android. But looking at these docs it seems you can follow the standard steps on xcode to get it, as shown here.
For apk (Android) run the command :
flutter build apk --release
For ipa (iOS) run the command :
flutter build ios --release
Then to get actual .ipa file, open xcode -> Product -> archive -> Distribute App -> Ad Hoc -> Export
You can then save the .ipa(which is inside the Runner folder) file in any location
I also had this question and had a really tough time finding the right solution.
First of all in the terminal of your code editor type:
flutter build apk --release
and after that go to this location:
yourAppFolder/build/app/outputs/apk/release/app-release.apk
I do not do development for iOS so I don't know much about that.
For Android, an APK is generated every time you build the app, e.g. with flutter run. You will find that in your project folder under <project>/build/app/outputs/apk/debug/app-debug.apk.
Follow below steps to get .apk and .ipa from flutter app in Mac system
First, Enter below command in your terminal to go your project directory
cd $(PROJECT FOLDER PATH)
For android apk build to upload store, Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build apk --release
To get ios ipa , Enter below command
sudo $(FLUTTER SDK PATH till bin)/flutter build ios --release
To get an apk, it is simple. Just use :
flutter build apk
To get an ipa, It is more complicated. First use :
flutter build ipa
Be careful to use flutter build ipa, not flutter build ios, because the second one builds a ".app" file instead of ".xcarchives" file.
Once you have the ".xcarchives" file, you can open it in XCode and click on "Distribute the app" to export an ipa file on your computer.
For iOS:
Step 1: open terminal and type cd "your flutter sdk path"
Step 2: cd export PATH=/Users/yourname/Downloads/flutter/bin:$PATH
Step 3: cd your project path
Step 4: flutter build ios --release
run step 1 to 4 in terminal.
After that open android studio and go to iOS folder path and open project.pbxproj file with ios module and in xcode you need to choose generic ios device and select archive, it will generate ipa build for you.
Android(After adding release build type run below command which will generate release apk with below version)
flutter build apk --build-name=1.0.1 --build-number=1
iOS
flutter build ios --release
For a detail explanation read the below article.
https://medium.com/#ralphbergmann/versioning-with-flutter-299869e68af4
For apk, you can use flutter build apk --release to get the release version of your apk on either windows/macOS.
For ipa, you have to use flutter build ios --release to get the release version of your apk on macOS.
Note: You can get a ipa on macOS only.
If you want this apk and .ipa with flavour then you can refer below commands for internal and production.
iOS:
flutter build ios --debug --flavor internal
flutter build ios --release --flavor production
android:
flutter build apk --debug --flavor internal
flutter build apk --release --flavor production
Updated for iOS :-
first you need to go to your current working directory and run the following command;
flutter build ios --release
After successfully completion of build, you can find build on below path;
/Users/sanjaybalaji/Documents/KiranFlutterApps/hb_calculator/build/ios/iphoneos/Runn
er.app.
you can check below screenshots for more details.
You can find your app apk after you run the app at path
<project_dir>/build/app/outputs/flutter-apk/app.apk

How can I install my ionic app on my android phone?

I'm trying to install my ionic app on my android phone. I tried
install my ionic app on my android phone
The app ran on my phone, but when I ran the same command to run a different app, the app was replaced on my mobile. How can I keep both? I don't intend to modify any of these apps, they are ready. I tried these commands as well:
ionic cordova build android --prod --release
and
ionic cordova run android --prod --release
I got this error message:
[ERROR] An error occurred while running cordova run android --release
(exit code 1)
By default, it will overwrite the previous version. You can keep the both app using below way:
Check the config.xml file, and change the id of the app.
<widget id="new.app.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Now, it will be considered as a different app and will not replace the previous one.

Ionic3 splash screen and icon - No platfrom detected

Let me first say. Each time i run
ionic cordova build android --dev
It first run this command
cordova platform add android
At the start of the project I already added the android platform successfully. So I dont know why on every build it has to add android platform again. But each build works perfectly well on my phone. Then yesterday when I tried to run
ionic cordova resources
and it says
no platform detected. Please run ionic cordova platfrom add
Please help