Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228535 articles
Browse latest View live

Translation custom loader CORS issue when reading from data directory

$
0
0

I have created a custom loader for ngx-translate within an Ionic (v4) app. I have done this because I want to download the latest translation files from a server and then save into the data directory so they are accessible when the app is offline.

I have succeeded with this part. However, I am now experiencing issues with CORS within my getTranslation function.

How can I get around this issue?

getTranslation(lang: string): Observable<any> {
    const subDirectory = 'i18n';
    const fileName = lang;
    const fileExtension = '.json';
    let rootDirectory = '';
    let rootDirectoryPath = '';
    let directory = '';
    let directoryPath = '';
    if (this.platform.is('cordova')) {
      this.platform.ready()
        .then(() => {
          rootDirectory = this.file.dataDirectory;
          rootDirectoryPath = rootDirectory;
          directory = rootDirectoryPath + subDirectory;
          directoryPath = directory + '/';
          console.log(directoryPath + fileName + fileExtension + ':');
          this.http
            .get(directoryPath + fileName + fileExtension)
            .pipe(map((res: any) => res))
            .subscribe(translationData => {
              console.log(translationData);
            });
          const translation = this.http.get(directoryPath + fileName + fileExtension);
          return translation;
        });
    } else {
      rootDirectory = '/assets/data';
      rootDirectoryPath = rootDirectory + '/';
      directory = rootDirectoryPath + subDirectory;
      directoryPath = directory + '/';
      const translation = this.http.get(directoryPath + fileName + fileExtension);
      return translation;
    }
  }

Setting native version numbers with capacitor?

$
0
0

With cordova, we could configure a few version numbers using attributes on the tag in config.xml:

<widget
  android-versionCode="1.0"
  ios-CFBundleVersion="1.0"
  version="1.0"
  >

How do we set those such that they make it over to the native project when capacitor is synced?

Npm installation error with ionic-cli

Issue while generating apk

$
0
0

I am able to run application and seems fine with “ionic serve” but when generating apk giving following wrror,

 cordova.cmd build android
cordova-plugin-androidx-adapter: Processed 48 Java source files in 1152ms
Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=D:\Software\AndroidSDK (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details
:wrapper

BUILD SUCCESSFUL in 32s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\app\build.gradle' line: 93

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
   > Could not find com.google.android.gms:strict-version-matcher-plugin:1.1.0.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
     Required by:
         unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 23s
> Configure project :app
E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\app\build.gradle' line: 93

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
   > Could not find com.google.android.gms:strict-version-matcher-plugin:1.1.0.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
     Required by:
         unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 23s
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

I am not able to find solution for this. My project configuration is,

Ionic:

   Ionic CLI          : 5.1.0 (C:\Users\Admin\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 17 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.3

System:

   Android SDK Tools : 26.1.1 (D:\Software\AndroidSDK)
   NodeJS            : v10.16.0 (C:\Program Files (x86)\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

Please suggest me the solution.

Thanks,
Nilesh

InvalidValueError: not an instance of HTMLInputElement w/ Ionic 4/5

How to set up css/scss global for ionic/[Vue]?

$
0
0

Since the install of ionic/vue doesn’t install the unminified css or anything for that matter in the project /src directory, how can I set the css global variables for an ionic/vue project?

[ionic4] - by mistake deleted config.xml file

$
0
0

I was going to discard some changes from config.xml file. As I did not set up git, it asked me to delete the file when I clicked on discard. And by mistake I deleted the file. Now that deleted config.xml is not present in trash. When I run the command “ionic cordova run browser”, it instantly gives the following error:

[ERROR] Cannot load ./config.xml
        
        Cordova config.xml file not found.

        You can re-add the Cordova integration with the following command: ionic integrations enable cordova --add

Anybody plz help me to recover my config.xml file…

@lucasbasquerotto

Android dev builds on API 28/29 show ERR_CLEARTEXT_NOT_PERMITTED

$
0
0

Seems like a solved problem for cordova. Any way to handle for capacitor?


How to write javascript code in typescript

$
0
0

var timer;

var compareDate = new Date();
compareDate.setDate(compareDate.getDate() + 9
); //just for this demo today + 7 days

timer = setInterval(function() {
timeBetweenDates(compareDate);
}, 1000);

function timeBetweenDates(toDate) {
var dateEntered = toDate;
var now = new Date();
var difference = dateEntered.getTime() - now.getTime();

if (difference <= 0) {
// Timer done
clearInterval(timer);
} else {
var seconds = Math.floor(difference / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);

hours %= 24;
minutes %= 60;
seconds %= 60;

$("#days").text(days);
$("#hours").text(hours);
$("#minutes").text(minutes);
$("#seconds").text(seconds);

}
}

Generating and APK file. Error?

$
0
0

Thanks a lot etpi, this solved my issue.

Adding "Authorization" header in get request

$
0
0

yes this is working for me. thank you so much for posting

I'm trying to upload my App for Android TV and the Google team rejects me

$
0
0

The Google team responds with the following

Your app does not contain a full-size app banner or is it not visible in the launcher. We are targeting 1080P, which we consider xhdpi. Apps should include the banner in the xhdpi (320 dpi) drawables folder with a size of (320px × 180px). Please refer to our Home Screen Banner and UI Patterns documentation.

The title should help users identify apps in the launcher. Please refer to our Visual Design and User Interaction documentation for more information.

For example, your banner does not fill the entire banner space.

The app is developed with ionic 4, how could I solve this inconvenience?

Compile Ionic 4 for Android 9 (Pie)

$
0
0

Hello. I would like to see how can i compile my finished app for Android 9 (Pie)?
When i try compile my code with ionic build android. was compiled for android 8 (oreo) and that brought me problems because my http.get are not working on android 9, only works on android 8 and less, i tried to compiled with ionic build android@9.0.0, and not works
I need a solution with this issue, Thanks in advance

error: process launch failed: Security

$
0
0

When i run ionic cordova run ios --device -- I get the following error…

verbose(lldb) command script add -s asynchronous -f fruitstrap_828bb79436e53a8fe3e9d624710bf67bf3033f89.safequit_command safequit (lldb) connect (lldb) run error: process launch failed: Security (lldb) safequit

Application has not been launched

Command finished with error code

1: ios-deploy --justlaunch,–no-wifi,-d,-b,/Users/sysadmin/new/platforms/ios/build/device/MyApp.app ios-deploy: Command failed with exit code 1 Error: ios-deploy: Command failed with exit code 1 at ChildProcess.whenDone (/Users/sysadmin/new/node_modules/cordova-common/src/superspawn.js:135:23) at ChildProcess.emit (events.js:197:13) at maybeClose (internal/child_process.js:978:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5) [ERROR] An error occurred while running subprocess cordova.

    cordova run ios --device --verbose exited with exit code 1.

    Re-running this command with the --verbose flag may provide more 
    information.

ionic:utils-process onBeforeExit handler: process.exit received +0ms ionic:utils-process onBeforeExit handler: running 2 functions +0ms ionic:utils-process onBeforeExit handler: exiting (exit code 1) +43ms

Where to put global SCSS files in an Ionic 3 project and when it get converted into css file

$
0
0

You can add the custom styles in styles.scss , but remind that if they are intermediate stylesheets, you must add !important to ensure:

ion-input {
   --background: var(--ion-color-light) !important;
}

Note: Use var(--ion-color-light) to apply Ionic native light (white) color from variables.scss .


Android App Bundle

$
0
0

It is true I have not filled 3 points.

thank you very much for your reply.

Ionic build failure due to Manifest merger failed

Build Break with aapt error message . why?

$
0
0

This build failure is due to a major version release of the Google Play Services and Firebase libaries on June 17.

Worked for me

Run:

  1. ionic cordova platform rm android
  2. if your using firebase
cordova plugin remove cordova-plugin-firebase

cordova plugin add cordova-plugin-firebase-lib
  1. Run:

ionic cordova plugin add cordova-plugin-androidx

  1. Run:

ionic cordova plugin add cordova-plugin-androidx-adapter

  1. Run: ionic cordova platform add android@8.0.0

Enjoy with your apk

ionic cordova build android --prod --release

Build Break with aapt error message . why?

$
0
0

I almost gave up, since i have going to different thread for almost 4 days. This is really frustrating that this can break you app without any apparent reason.

check project.properties in the android project root folder for
com.google.android.gms:play-services-gcm if it value is com.google.android.gms:play-services-gcm:+ you would need downgrade play services possible to com.google.android.gms:play-services-gcm:16.1.0 should fix for most people if they problem occurred. You try different versions but making changes in the files itself to fully fix it you would need to identify the package using it and install is properly. Here is the link to the releases https://developers.google.com/android/guides/releases you can find the version which suits you.

Old/stale bundles/chunks not being cleaned from build dirs for ionic 4/Angular

$
0
0

ping :slight_smile: no one dealing with cleanup of stale build bundle files?

Viewing all 228535 articles
Browse latest View live