When I tried using Picaso and OKHttp together in to app/build.gradle this issue started. Please help me to resolve this issue. Thanks you in advance.
Multidex support for **Android 5.0 and higher**
Step 1 : add MultidexEnabled true in app/build.gradle
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
// Enabling multidex support.
multiDexEnabled true
}
**Step 2 :**
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
**Step 3:** in your manifest add the MultiDexApplication class from the multidex support library to the application element.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
For More details about this please refer Google Developer site:
[Click Here][1]
I hope this help.
[1]: http://developer.android.com/intl/es/tools/building/multidex.html
Related
I recently installed Android Studio and when ever I start a new Project no matter what I keep getting this error :
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.2.0-beta03/gradle-4.2.0-beta03.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project.
and offline mode doesn't work either . I really ran out of ideas . if anyone can help me please do. thanks.
this is my build gradle :
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
and this is build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0-beta03"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and when I'm clicking on Offline mode this error appears :
A problem occurred configuring root project 'My Application'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.2.0-beta03.
Required by:
project :
> No cached version of com.android.tools.build:gradle:4.2.0-beta03 available for offline mode.
> No cached version of com.android.tools.build:gradle:4.2.0-beta03 available for offline mode.
Possible solution:
- Disable offline mode and rerun the build
The always working and best solution is to delete the full application with the sdk's if you have any projects take a backup of them and reinstall android studio. That's the most easiest way.
Try to disable gradle offline mode. You can find how to here: How to disable gradle 'offline mode' in android studio?. Then wait for gradle files to sync after restart.
Jcenter is no longer available.
You must replace all jcenter()s in you build.gradle with mavenCentral().
Also check your Internet connection(VPN) and proxies because it seems you have problems with your connection.
I use the following build.gradle to generate .apk files, the result will be MagnifyingGlass-V1.01-free-release.apk for free edition and MagnifyingGlass-V1.01-pro-release.apk for pro edition. -free-release or -pro-release is added to filename as suffix automatically by Android Studio 3.4.2.
I try to use the same build.gradle to generate .aab files, I find the result is MagnifyingGlass-V1.01 for free and MagnifyingGlass-V1.01 for pro, there are same, why? -free-release or -pro-release isn't added to filename as suffix automatically by Android Studio 3.4.2.
Added content:
I generated different edition .apk and .aab using Android Studio just like Image 1.
build.gradle
android {
compileSdkVersion 28
flavorDimensions "default"
defaultConfig {
applicationId "info.dodata.magnifyingglass"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.02"
archivesBaseName = "MagnifyingGlass-V" + versionName
}
productFlavors {
free {
applicationId "info.dodata.magnifyingglass"
}
pro {
applicationId "info.dodata.magnifyingglass.pro"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "IsDebugMode", "false"
}
debug {
buildConfigField "boolean", "IsDebugMode", "true"
}
}
}
Image 1
This is because the name of the bundle is being rigidly applied (there might be a relevant ticket available on the issue-tracker).
Once left a workaround here: How to change the generated filename for App Bundles with Gradle?
This approach can also be used to finalize these flavors, based upon their final task's name. Another optimization would be, to use the Apache Ant integration on the generated bundle. For some reason (unknown to me), Gradle does not support move (rename) operations out-of-the-box.
This configuration appears pretty useless (and there might be other configurations missing):
buildConfigField "boolean", "IsDebugMode", "true"
because in Java that is known as BuildConfig.DEBUG; better replace that with configuration applicationIdSuffix ".debug" - and also add the corresponding applicationIdSuffix ".release" (which rather sounds alike the intended outcome); for example:
buildTypes {
release {
applicationIdSuffix ".release"
...
}
debug {
applicationIdSuffix ".debug"
...
}
}
This is now available in gradle version 3.5.2 where the product flavor suffix is applied automatically.
we are using ionic3 framework for building mobile apps. we are getting the following error while uploading apk to the playstore.
Upload failed:
You need to use a different version code for your APK because you already have one with version code 98.
currently we have the following versioncode and versionname in playstore
android:versionCode = "8"
android:versionName = "1.9"
But if we try change android:versionCode to 9 and android:versionName to 2.0 , we are getting the above error.
AndroidManifest.xml
<manifest xmlns:tools="http://schemas.android.com/tools" android:hardwareAccelerated="true" android:versionCode="9" android:versionName="2.0" package="com.global.upi.app" xmlns:android="http://schemas.android.com/apk/res/android">
Apparently, you have already uploaded a version with versionCode=98 so you'll need to upload a version with versionCode=99 at least.
versionName should not matter much as far as uploading goes.
I've been trying to properly import this library to begin writing an image editing component for my application. I currently have the downloaded 'creativesdk-repo' folder in the root directory, and have followed instructions according to this tutorial:
https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html.
And this tutorial as well:
https://creativesdk.adobe.com/docs/android/#/articles/imageediting/index.html
There are no problems building when I simply use the basic authorization library, but my application needs photo editing capability. My foremost problem (among many) lies within the build.gradle file of the application (not the encompassing project build.gradle file).
Here is the code in my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
compile 'com.adobe.creativesdk.image:4.0.0'
}
The very last line causes an error message to appear:
Error:Failed to resolve: com.adobe.creativesdk.image:4.0.0:
Open File
I believe these messages mean that the image editing portion of the Adobe Creative SDK libraries are not being recognized. I have even tested this with example projects from Adobe and it runs into the same problem. What can I do to fix this and start writing this portion of my application?
You need download creative-sdk repo from download links into your project folder. In the project gradle define creative-sdk repo url like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven{
url "${project.rootDir}/creativesdk-repo" //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
}
}
}
In your app build.gradle define this:
compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
compile 'com.adobe.creativesdk:image:4.0.0'
You should extend your Application class and implement this, something like this:
public class ExampleApplication extends MultiDexApplication implements IAdobeAuthClientCredentials , IAviaryClientCredentials {
private static final String CREATIVE_SDK_SAMPLE_CLIENT_ID = "62bbd145c3f54ee39151823358c83e28";
private static final String CREATIVE_SDK_SAMPLE_CLIENT_SECRET = "2522a432-dfc8-40c4-94fe-646e10223562";
#Override
public void onCreate() {
super.onCreate();
AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());
}
#Override
public String getClientID() {
return CREATIVE_SDK_SAMPLE_CLIENT_ID;
}
#Override
public String getClientSecret() {
return CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
}
#Override
public String getBillingKey() {
return "";
}
}
In your AndroidManifest.xml inside Application tag put this:
<provider
android:name="com.aviary.android.feather.sdk.internal.cds.AviaryCdsProvider"
android:authorities="com.package.AviaryCdsProvider"
android:exported="false"
android:process=":aviary_cds" />
With this configuration you can call Aviary Sdk Activity with this:
Intent newIntent = new AviaryIntent.Builder(this);
//config values
startActivity(newIntent);
I configure SDK like this, and its working. Sorry for the delay.
UPDATE 10/10/2016:
Thanks to Ash Ryan:
Trying to make an Android Studio Application with Adobe Creative SDK Image Editing, cannot get libraries compiled in gradle
Use this:
//noinspection SpellCheckingInspection
repositories {
// ...
// For Adobe Creative SDK
maven { url 'https://repo.adobe.com/nexus/content/repositories/releases/' }
}
Source: https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html
Please make sure under global project repo. If not gradle not able to find the path.
allprojects {
repositories {
compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
compile 'com.adobe.creativesdk:image:4.0.0'
}
I think your error is here. Change:
complie 'com.adobe.creativesdk.image:4.0.0'
for this:
compile 'com.adobe.creativesdk.image:4.0.0'
It`s a simple sintax error.
UPDATE 10/10/2016:
Thanks to Ash Ryan:
Trying to make an Android Studio Application with Adobe Creative SDK Image Editing, cannot get libraries compiled in gradle
just use latest lib dependency in Module:app build.gradle file and update your android sdk and android studio
compile 'com.adobe.creativesdk:image:4.6.3'
so I have an Android project in Android Studio (0.6.1). There are 2 Modules A and B. A is my main-module and it depends on B which includes various resources (drawables, strings, styles) and therefore functions as something like a library (although it is no library-project). I added B as git-subtree, included it in my settings.gradle and building works fine.
Now there is a problem: I want to reference resources from B in A. For drawables I already found out here that I can just create dummy resources in A that will be overridden by B. But unfortunately that doesn't work for styles, that are defined in B. The dummies I create in styles.xml in A are not overwritten.
My aim is to define multiple styles in B like:
<style name="ButtonStyle1" parent="android:Widget.Button">
<item name="android:layout_width">wrap_content</item>
<item name="android:minWidth">200dp</item>
<item name="android:background">#drawable/buttonorange</item>
<item name="android:textColor">#android:color/black</item>
</style>
<style name="ButtonStyle2" parent="android:Widget.Button">
<item name="android:layout_width">wrap_content</item>
<item name="android:minWidth">200dp</item>
<item name="android:background">#drawable/buttonorange</item>
<item name="android:textColor">#android:color/black</item>
</style>
And then back in A I want to have the opportunity to choose wether to apply ButtonStyle1 or ButtonStyle like:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:buttonStyle">#style/ButtonStyle1</item>
</style>
or
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:buttonStyle">#style/ButtonStyle2</item>
</style>
But when I do this, I always get
Error:(5, 42) No resource found that matches the given name (at 'android:buttonStyle' with value '#style/ButtonStyle1').
All in all I guess that my gradle configuration itself is correct because overriding drawables works fine already. So what am I doing wrong - how can I reference styles defined in B in A?
settings.gradle
include ':app', ':uiframework:uiframework'
build.gradle from A
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'com.example.uiframeworkexample'
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':uiframework:uiframework')
}
Make sure you apply correct plugin for your B(library) project at build.gradle file
apply plugin: 'com.android.library'