Skip to content

Commit

Permalink
Android SDK v3.12.4 | Issue in dependencies download from Maven
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaileshmishra committed Jan 29, 2024
1 parent fd4e83f commit 079ee48
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 68 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ buildscript {
agp_version = '8.2.1'
}
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:8.2.1" //8.2.1
//classpath "com.android.tools.build:gradle:8.2.1" //8.2.1
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0-rc-1'
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
}
Expand Down
62 changes: 37 additions & 25 deletions contentstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ plugins {
}

import com.vanniktech.maven.publish.SonatypeHost

android.buildFeatures.buildConfig true

mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
coordinates("com.contentstack.sdk", "android", "3.12.4-rc2-SNAPSHOT")
coordinates("com.contentstack.sdk", "android", "3.12.5")

pom {
name = "contentstack-android"
description = "The Content Delivery SDK facilitates the retrieval of content from your Contentstack account, enabling seamless delivery to your web or mobile properties.."
inceptionYear = "2018"
packaging 'aar'
url = "https://github.com/contentstack/contentstack-android"
licenses {
license {
Expand All @@ -32,7 +34,7 @@ mavenPublishing {
}
scm {
url = "scm:[email protected]:contentstack/contentstack-android"
connection = "scm:git:git://github.com/username/mylibrary.git"
connection = "scm:git:git://github.com/contentstack/contentstack-android.git"
developerConnection = "scm:[email protected]:contentstack/contentstack-android.git"
}
}
Expand All @@ -52,17 +54,18 @@ tasks.register('jacocoTestReport', JacocoReport) {
}))
}
}

android {
namespace "com.contentstack.sdk"
//namespace "com.contentstack.sdk"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/LICENSE-notice.md'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/DEPENDENCIES")
exclude("META-INF/LICENSE")
exclude("META-INF/LICENSE.txt")
exclude("META-INF/license.txt")
exclude("META-INF/NOTICE")
exclude("META-INF/NOTICE.txt")
exclude("META-INF/notice.txt")
exclude("META-INF/ASL2.0")
exclude("META-INF/*.kotlin_module")
}

Expand All @@ -75,22 +78,23 @@ android {
}
signingConfigs {
debug {
storeFile file("/Users/shaileshmishra/keystore/release.keystore")
storeFile file("/Users/shaileshmishra/keystore/key.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyAlias 'key0'
keyPassword 'android'
}
release {
storeFile file("/Users/shaileshmishra/keystore/release.keystore")
storeFile file("/Users/shaileshmishra/keystore/key.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyAlias 'key0'
keyPassword 'android'
}
}
compileSdk 26
compileSdk 30
defaultConfig {
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
minSdkVersion 19
minSdkVersion 23
versionCode 1
versionName "1.0"
useLibrary 'org.apache.http.legacy'
Expand All @@ -105,6 +109,8 @@ android {
debug {
debuggable true
testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

buildConfigField "String", "host", localProperties['host']
buildConfigField "String", "APIKey", localProperties['APIKey']
buildConfigField "String", "deliveryToken", localProperties['deliveryToken']
Expand All @@ -118,26 +124,32 @@ android {
}
}
//flavorDimensions "default"
lintOptions { abortOnError false }
//lintOptions { abortOnError false }
compileOptions {
//coreLibraryDesugaringEnabled true
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
configurations { archives }
dependencies {
def multidex_version = "2.0.1"
def multidex = "2.0.1"
//def sdk_utils = "1.2.6"
def volley = "1.2.1"
def junit = "4.13.2"
configurations.configureEach { resolutionStrategy.force 'com.android.support:support-annotations:23.1.0' }
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.contentstack.sdk:utils:1.2.6'
implementation 'com.android.volley:volley:1.2.1'
implementation 'junit:junit:4.13.2'
//implementation "com.contentstack.sdk:utils:$sdk_utils"
implementation "com.android.volley:volley:$volley"
implementation "junit:junit:$junit"
// For AGP 7.4+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
implementation "androidx.multidex:multidex:$multidex_version"

//implementation "androidx.multidex:multidex:$multidex"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:core:1.5.0'
//testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.contentstack.sdk;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.util.Log;

import org.junit.BeforeClass;
Expand All @@ -13,6 +13,7 @@
import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.assertEquals;

import androidx.test.InstrumentationRegistry;
import androidx.test.core.app.ApplicationProvider;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import static org.junit.Assert.assertNotNull;

import android.content.Context;
import android.support.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import android.util.Log;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
21 changes: 12 additions & 9 deletions contentstack/src/main/java/com/contentstack/sdk/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.text.TextUtils;

import java.util.Objects;

import javax.validation.constraints.NotNull;

/**
* Set Configuration for stack instance creation.
Expand Down Expand Up @@ -47,13 +47,13 @@ public void setBranch(String branch) {
*
* <br><br><b>Example For Different Regions:</b><br>
* <pre>
* {@code
* config.setRegion(ContentstackRegion.US);
* config.setRegion(ContentstackRegion.EU);
* config.setRegion(ContentstackRegion.AZURE_EU);
* config.setRegion(ContentstackRegion.AZURE_NA);
* }
* </pre>
* {@code
* config.setRegion(ContentstackRegion.US);
* config.setRegion(ContentstackRegion.EU);
* config.setRegion(ContentstackRegion.AZURE_EU);
* config.setRegion(ContentstackRegion.AZURE_NA);
* }
* </pre>
*/
public ContentstackRegion setRegion(ContentstackRegion region) {
this.region = region;
Expand All @@ -69,7 +69,10 @@ public String[] getEarlyAccess() {
return this.earlyAccess;
}

public Config earlyAccess(@NotNull String[] earlyAccess) {
public Config earlyAccess(String[] earlyAccess) {
if (earlyAccess == null) {
Objects.requireNonNull("Null early access");
}
this.earlyAccess = earlyAccess;
return this;
}
Expand Down
19 changes: 14 additions & 5 deletions contentstack/src/main/java/com/contentstack/sdk/Contentstack.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;


import java.io.File;

import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
* Contains all Contentstack SDK Classes And Methods.
Expand Down Expand Up @@ -45,7 +43,9 @@ private Contentstack(Context context) {
* @return {@link Stack} instance. <br><br><b>Example :</b><br> <pre class="prettyprint"> Stack stack = Contentstack.stack(context, "apiKey", "deliveryToken", "stag"); </pre>
* @throws Exception the exception
*/
public static Stack stack(@NotNull Context context, @NotNull String apiKey, @NotNull String deliveryToken, @NotNull String environment) throws Exception {
public static Stack stack(Context context, String apiKey, String deliveryToken, String environment) throws Exception {
checkIfNull(context, apiKey, deliveryToken, environment);

if (!TextUtils.isEmpty(apiKey) || !TextUtils.isEmpty(deliveryToken) || !TextUtils.isEmpty(environment)) {
Config config = new Config();
config.setEnvironment(environment);
Expand All @@ -56,6 +56,13 @@ public static Stack stack(@NotNull Context context, @NotNull String apiKey, @Not
}
}

private static void checkIfNull(Context context, String apiKey, String deliveryToken, String environment) {
Objects.requireNonNull(context, "can not be null");
Objects.requireNonNull(apiKey, "can not be null");
Objects.requireNonNull(deliveryToken, "can not be null");
Objects.requireNonNull(environment, "can not be null");
}

/**
* Authenticates the stack api key of your stack.
* This must be called before your stack uses Contentstack sdk.
Expand All @@ -70,7 +77,9 @@ public static Stack stack(@NotNull Context context, @NotNull String apiKey, @Not
* @return {@link Stack} instance. <br><br><b>Example :</b><br> <pre class="prettyprint"> Config config = new Config(); config.setEnvironment("stag"); Stack stack = Contentstack.stack(context, "apiKey", "deliveryToken", config);
* @throws Exception the exception
*/
public static Stack stack(@NotNull Context context, @NotNull String apiKey, @NotNull String deliveryToken, @NotNull String environment, @NotNull Config config) throws Exception {
public static Stack stack(Context context, String apiKey, String deliveryToken, String environment, Config config) throws Exception {
checkIfNull(context, apiKey, deliveryToken, environment);
Objects.requireNonNull(config, "Config can not be null");
if (!TextUtils.isEmpty(apiKey) || !TextUtils.isEmpty(deliveryToken) || !TextUtils.isEmpty(environment)) {
config.setEnvironment(environment);
ctx = context;
Expand Down
Loading

0 comments on commit 079ee48

Please sign in to comment.