How to remove 'io.card' from Cordova/payPal SDK - android

I am building Android app with cordova on windows PC and I have been trying to remove 'io.card' from my payPal cordova sdk in order to reduce the size of my apk; but to no avail.
I have read their manual about Disabling Direct Credit Card Payments by including
`dependencies {
compile('com.paypal.sdk:paypal-android-sdk:2.15.1') {
exclude group: 'io.card'
}
}`
in "MY" build.gradle file. They did not show the location of the build.gradle file that should be modified. However I managed to find a build.gradle file under "PROJECT_FOLDER/platforms/android/" However, when I add the
compile('com.paypal.sdk:paypal-android-sdk:2.15.1') {
exclude group: 'io.card'
}
But when I do a new build (cordova run) the dependencies gets removed and therefore the size of my application remains 33.6MB instead of 17.6MB.
I have also seen This Post But the answer is not clear to me.
I will be glad if someone can show me what I am doing wrong, or not doing right. Thank you
This is the link to my build.gradle file -> build.gradle

Related

Android API Level Inconsistencies

So I am trying to use this library in my android app to be able to show pdf files. However, when I add the install line to my build.gradle file, Android Studio says that all Android support libraries should use the same version. This happens because the library uses com.android.support:support-compat:26.1.0 while my project is using com.android.support:appcompat-v7:28.0.0.
I want to know if there is a way to get around this and use the library in my project, or if I would have to fork and update the library myself to make it work.
Any help is appreciated.
simply exclude it from the build:
api ("com.github.barteksc:android-pdf-viewer:2.8.2") {
exclude group: "com.android.support", module: "appcompat-v7"
}

Remove firebase analytics from android app completely

I added firebase analytics in my app just to try it out. I followed the steps in official guidelines.
Now I have decided against it. I have undone whatever I had done to add it.
(Removed entries from project level and app level build.gradle; removed all usages from source code.)
But I am still getting logs like this when my app runs:
I/FirebaseInitProvider: FirebaseApp initialization successful
This leads me to believe that I haven't removed it completely. This is really a matter of concern for me now because my app has exceeded method count limit and I have had to enable multidex.
How can I completely remove firebase from my app?
If you want to completely remove the firebase, you can achieve it by reversing the setup steps.
Remove classpath 'com.google.gms:google-services:3.0.0' from your project gradle.
Remove compile 'com.google.firebase:firebase-core:9.2.0' from your app build.gradle.
Remove apply plugin: 'com.google.gms.google-services' from the bottom of your build.gradle.
Remove FirebaseService code from your project.
Remove google-services.json from your project.
Remove google key from your Manifest.
Remove google key from your resource value.
Clean project.
Build project.
Remove installed app from test device, then install it again.
-- UPDATE --
From https://stackoverflow.com/a/37945280/4758255 :
I would suggest you to exclude the firebase group using gradle in app module build.gradle, you can add this in dependency:
compile('com.google.android.gms:play-services-ads:9.0.2') {
exclude group: 'com.google.firebase', module: 'firebase-common'
}
compile('com.google.android.gms:play-services-gcm:9.0.2') {
exclude group: 'com.google.firebase', module: 'firebase-common'
}
Or, simply apply a global exclude configuration (Remember that this should be outside any groovy function), like this :
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-common'
}
Adding
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-core'
all*.exclude group: 'com.google.firebase', module: 'firebase-iid'
}
removes all lines from app/app.iml containing firebase (and they do not get added automatically again) and removes all firebase libraries from generated code and intermediate output as well.
Compared to the previous answer this knocks off another 87,000 bytes from apk size.
Though I still do not understand why I should have to ADD more code to undo adding something. It's probably a bug in the build system.
#isnotmenow: Thanks a lot for pointing me in this direction.
I had the same issue, i removed google_services.json file. Removed firebase dependencies and most importantly in build.gradle (Project: GrowBuds) remove the following line
apply plugin: 'com.google.gms.google-services'
i was also facing this issue and after too much effort i have find a legal solution
1)Change the package name
the method of changing the pacakage name
1) convert your studio from project level to android level
2)right click on android level and click on Compact middle pacakage
3)change the middle name of packge
4)again like 3rd step change the last name of package
5)change the package name in gradle file
2)go to firebasel console add project manullay
add your new pacakge name
add your sha1 key and continue
3)synchronise your project yahoo you have done \
List item

Gradle dependencies for Android app which uses google cloud endpoint client libs

While following along with the demo in this video :
https://www.youtube.com/watch?v=7Sp4Lr3Qmcw
I noticed that at 16:56 in the video :
http://youtu.be/7Sp4Lr3Qmcw?t=16m56s
the presenter pastes the following snippet into build.gradle of the android app :
compile('com.google.todotxt.backend:taskApi:v1-1.17.0-rc-SNAPSHOT') {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile('com.google.http-client:google-http-client-android:1.17.0-rc') {
exclude(group: 'com.google.android', module: 'android')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
but does not explain how he got those lines.
The previous step of :
==> ./gradlew appengineEndpointsInstallClientLibs
also does not show what artifacts were created and what the names of the artifacts were.
So, it is not clear how the presenter obtained the names of the artifacts from the previous step.
Does anyone know how the presenter was able to figure out what the names are, of the artifacts generated from the the install-client-libraries-step are.
That video is from an older version of Android Studio. Updated instructions for integrating an appengine backend with your android application are available at : https://github.com/GoogleCloudPlatform/gradle-appengine-templates
Basically there is some cross module dependency configuration that tells your android module to pull the endpoints artifact from the appengine module. The new flow doesn't use a Maven repository anymore.
However if you still want to find out how the names are discovered. You have to go into the build directory of your appengine project, into the client libraries folder, unzip those zips and looks in the build.gradle file for the client library to see the artifact output name.

Android Studio exclude package from build [duplicate]

I'm developing an android app using android studio as IDE.
My question is:
How to exclude certain files under certain directory during the process of building APK?
In my case, I want to exclude some images from building since the those files used in my project are designated to be downloaded from network in-app while during the development I hope to refer them in the layout.
After googling, I found some solutions:
Gradle 1.2: Exclude directory under resources sourceSets
How to exclude file from resources using Gradle and Android Studio?
And reference from gradle.org
Then I came up my solution in build.gradle:
sourceSets {
main {
resources.exclude '**/drawable/*'
res.exclude '**/drawable/*'
}
}
But it doesn't work, the image under res/drawable/ still shows up(before downloading).
The Android Studio version is currently 0.8.4.
Any idea would be appreciated.
Exclude paths aren't currently supported for Android sourceSets. You can track this at bug https://code.google.com/p/android/issues/detail?id=64957
This is happening because Android sourceSets aren't the same as Java sourceSets; they're a custom implementation in the Android plugin, and don't automatically pick up all the features of their cousins. This will need to be specially implemented for Android, and it hasn't been done yet.

Android Studio: Exclude resource file under resources sourceSets

I'm developing an android app using android studio as IDE.
My question is:
How to exclude certain files under certain directory during the process of building APK?
In my case, I want to exclude some images from building since the those files used in my project are designated to be downloaded from network in-app while during the development I hope to refer them in the layout.
After googling, I found some solutions:
Gradle 1.2: Exclude directory under resources sourceSets
How to exclude file from resources using Gradle and Android Studio?
And reference from gradle.org
Then I came up my solution in build.gradle:
sourceSets {
main {
resources.exclude '**/drawable/*'
res.exclude '**/drawable/*'
}
}
But it doesn't work, the image under res/drawable/ still shows up(before downloading).
The Android Studio version is currently 0.8.4.
Any idea would be appreciated.
Exclude paths aren't currently supported for Android sourceSets. You can track this at bug https://code.google.com/p/android/issues/detail?id=64957
This is happening because Android sourceSets aren't the same as Java sourceSets; they're a custom implementation in the Android plugin, and don't automatically pick up all the features of their cousins. This will need to be specially implemented for Android, and it hasn't been done yet.

Categories

Resources