IONIC2 transformClassesWithDexForDebug - ionic2

I got this error
`FAILURE: Build failed with an exception.
What went wrong?
Execution failed for task ':transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat;
`
I have enabled Multidex (multiDexEnabled = true) in build.gradle and also added following
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "2g"
}
but still getting that error.

Even I was facing the similar issue, I tried updating Cordova, Ionic and setting ANDROID_HOME and JAVA_HOME and almost all the solution over the web, but nothing worked for me. Finally, it was the issue with PhoneGap-push plugin. The 2.0 version of PhoneGap-push plugin has some collision with some plugins like
Google Analytics
To be more specific the plugins that use google play services.
So Below is my solution.
First, remove the PhoneGap-push plugin 2.0 from your application.
Now try to build the app by commenting all the lines that use push plugin.
If the build is successful then it will be the issue with push plugin. Then follow below instructions to fix the issue. If the build is not successful then you might be having some other issue.
First, uninstall the PhoneGap-push plugin 2.0
Then go to project -> package.json and search for push and replace the line with “”: “4.0.1” earlier it will be 4.3.0 or 4.3.1
Now add push plugin again to the project with below command ionic plugin add phonegap-plugin-push#1.10.5 --variable SENDER_ID=XXXXXXX
Now build your app works like a charm....
This issue is already opened in phonegap-pushplugin repo . They have a next milestone of releasing version 2.1.0 which will be fixing this issue.

Related

Failed to find the transpiler exported from #dataform/core. Ensure packages are installed and upgrade to a recent version

I am following the quicktart example from the google documentation (https://cloud.google.com/dataform/docs/quickstart) but when I try to execute the workflow, I can't click on the Start execution button. I have an error in the right panel which tells me :
Failed to find the transpiler exported from #dataform/core. Ensure packages are installed and upgrade to a recent version.
I tried to add a package.json file like following :
{
"dependencies": {
"#dataform/core": "1.6.2"
}
}
But it's not working. Anyone have an idea of the issue ?
EDIT : Here are the screenshots
Using the web console doesn't work for me as well. For now the workaround that works for me is to develop locally via dataform core.
Try to go to the packages.json file and then push the "Install packages" button. (See the screenshot)
Install packages
It worked for me this way.
Premisse: Your workspace is connected to some git external repository.
Do this steps:
Delete your workspace;
Edit outside of workspace, using your IDE or cloud shell. Confirm if project_id is correct in dataform.json, if not fix. Confirm if your source is referenced the corrects the the project-ids and dataset names. If not, fix. Commit and push;
Re-create the workspace again;
Run the workflow

google artifact registry dependency NoSuchMethod

I am using google artifact registry to import my dependency to another project. When I run my project locally, everything works fine, but my gitlab CI pipeline fails with the following error
java.lang.NoSuchMethodError: org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.getConfiguredCredentials()Lorg/gradle/api/credentials/Credentials;
rt-test_1 | at com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin.configureArtifactRegistryRepository(ArtifactRegistryGradlePlugin.java:143)
rt-test_1 | at com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin.lambda$modifyProject$4(ArtifactRegistryGradlePlugin.java:114)
Can you please explain what's the problem and how can this be fixed. Thank you in advance
FYI, this has been fixed in version 2.1.1 of the Artifact Registry plugin.
Turns out there is a bug in gradle version so I changed it to older version and it worked.

ionic cordova plugin add cordova-plugin-advanced-http already installed

I am new on Ionic Mobile application development, so I am trying to POST data from Ionic app. Whenever I have run the app in browser using
ionic cordova run browser
It display below issue in console,
Native: tried calling HTTP.post, but the HTTP plugin is not installed.
Install the HTTP plugin: 'ionic cordova plugin add cordova-plugin-advanced-http'.
I have installed same plugin using terminal but terminal give warnings as its already installed.
Please Suggest.
Based on this https://ionicframework.com/docs/native/http/ you also need to run
npm install --save #ionic-native/http
and referencing it correctly in your app, please take a look at above link
Also for running app in browser try below command
Ionic serve
See https://github.com/ionic-team/ionic-native/issues/1975
The issue appears to have been fixed but there might be a lag in updating npm
I hade the same problem and I solve it with uninstall and reinstall the plugin
Uninstall plugin completely
ionic cordova plugin remove cordova-plugin-advanced-http
npm uninstall #ionic-native/http
and reinstall it
ionic cordova plugin add cordova-plugin-advanced-http
npm install #ionic-native/http
The Native Http plugin is the only way to handle the CORS from the client-side.
The way I see your problem, there might two possible fixes
Check whether the plugin is called after the platform.ready().
Even after it, if doesn't work or show the same error then follow this method.
// Declare cordova as a global constant
declare const cordova;
// directly call the cordova pulgin using "cordova.pulgin.http"
cordova.plugin.http.post(apiUrl, {}, {},
response => {},
response => {})

GoogleCloudMessaging integration on iOS using cocoapods

I'm trying to integrate GoogleCloudMessaging(GCM) on iOS project. (Cocos2d-x v3.2)
As per the google's instruction, (https://developers.google.com/cloud-messaging/ios/client)
I use cocoapods but failed with following error.
$ pod install
Updating local specs repositories
Analyzing dependencies
[!] Unable to satisfy the following requirements:
- `GoogleCloudMessaging` required by `Podfile`
Here are what I tested.
install GCM on cocos2dx project (v3.2) -> failed.
create a non-cocos2dx project and install GCM -> succeeded
install GoogleAnalytics on cocos2dx project -> succeeded.
create a cocos2dx project using v3.7 and install GCM -> failed.
I don't have any clue yet why installing GCM is failed but GoogleAnalytics is not.
Is there anyone who succeed integrating GCM on iOS?
EDIT
This is my Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'SampleApp iOS' do
pod 'GoogleCloudMessaging'
end
target 'SampleApp Mac' do
end
I could solve this problem referring a post in cocos2d-x forum.
Changing Deployment Target to 7.0 or higher in Xcode project setting will clear this issue.

Facebook SDK 4.0 - Composer Not Finding Repository

I'm trying to download the facebook/php-sdk-v4 repository into my project, running the "php composer.phar update" command.
I recently added this to the require section of my composer.json file:
"facebook/php-sdk-v4": "4.0.*",
Upon running the update command, I am given the following error:
---> Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package facebook/php-sdk-v4 1.0.0 could not be found.
It seems that I have set it up exactly according to the Facebook Graph API instructions as listed on this page:
https://developers.facebook.com/docs/php/gettingstarted/4.0.0
But... It's still unable to find the repository.
Does anybody know the name of the Facebook SDK 4.0 repository or see any reason why this process I am following isn't working?
Thanks for listening!