Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Update dependencies - fixed the build issue #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
compileSdkVersion 33
defaultConfig {
applicationId "com.google.android.samples.dynamiccodeloading"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 33
versionCode 33
versionName "1.0.33"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -51,18 +51,19 @@ dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

api 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
api 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation "com.google.android.play:core:1.4.1"
implementation "com.google.android.play:core:1.10.3"

daggerApi 'com.google.dagger:dagger:2.16'
api 'com.google.dagger:dagger-android-support:2.16'
daggerApi 'com.google.dagger:dagger:2.44.2'
api 'com.google.dagger:dagger-android-support:2.44.2'

kapt 'com.google.dagger:dagger-compiler:2.16'
kapt 'com.google.dagger:dagger-compiler:2.44.2'

implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha04'
androidTestImplementation 'androidx.test:rules:1.2.0-alpha04'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test:rules:1.5.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MainActivityTest {
@Before
fun before() {
PreferenceManager.getDefaultSharedPreferences(
InstrumentationRegistry.getInstrumentation().getTargetContext().applicationContext
InstrumentationRegistry.getInstrumentation().targetContext.applicationContext
).edit().clear().commit()
}

Expand All @@ -62,7 +62,7 @@ class MainActivityTest {

onView(withId(R.id.saveButton)).perform(click())

InstrumentationRegistry.getInstrumentation().runOnMainSync(Runnable { mActivityTestRule.activity.recreate() })
InstrumentationRegistry.getInstrumentation().runOnMainSync({ mActivityTestRule.activity.recreate() })

val textView = onView(withId(R.id.counterText))
textView.check(matches(withText("3")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package com.google.android.samples.dynamiccodeloading

import androidx.annotation.MainThread
import com.google.android.play.core.splitcompat.SplitCompatApplication
import com.google.android.samples.dynamiccodeloading.di.BaseComponent
import com.google.android.samples.dynamiccodeloading.di.DaggerBaseComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ object BaseModule {
if (storageFeature != null){
return storageFeature as StorageFeature
}
try {
return try {
// Get the instance of the StorageFeature.Provider, pass it the BaseComponent which fulfills the
// StorageFeature.Dependencies contract, and get the StorageFeature instance in return.
val provider = Class.forName(PROVIDER_CLASS).kotlin.objectInstance as StorageFeature.Provider
return provider.get(baseComponent)
provider.get(baseComponent)
.also { storageFeature = it } //cache the value for later calls
} catch (e: ClassNotFoundException){
Log.e(TAG, "Provider class not found", e)
return null
null
}
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.ViewModelProvider

/**
* The single, main activity of this sample.
Expand All @@ -48,7 +48,7 @@ class MainActivity : AppCompatActivity() {
saveText = findViewById(R.id.saveText)
saveButton = findViewById(R.id.saveButton)

viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
viewModel = ViewModelProvider(this)[MainViewModel::class.java]

incrementButton.setOnClickListener {
viewModel.incrementCounter()
Expand All @@ -58,7 +58,7 @@ class MainActivity : AppCompatActivity() {
viewModel.saveCounter()
}

viewModel.counter.observe(this, Observer {
viewModel.counter.observe(this, {
counterText.text = (it ?: 0).toString()
})

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.30'
ext.kotlin_version = '1.7.21'
repositories {
maven {
url "http://storage.googleapis.com/r8-releases/raw/master"
url "https://storage.googleapis.com/r8-releases/raw/master"
}
google()
jcenter()
mavenCentral()

}
dependencies {
classpath 'com.android.tools:r8:878ec25559ca91497517345ec3a6c16102b7025c' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools:r8:3.3.75' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -22,7 +22,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()

}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Apr 25 14:22:23 CEST 2019
#Sat Dec 17 13:53:34 IST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-rc-1-all.zip
zipStoreBase=GRADLE_USER_HOME
6 changes: 3 additions & 3 deletions storage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand Down Expand Up @@ -44,5 +44,5 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
kapt 'com.google.dagger:dagger-compiler:2.16'
kapt 'com.google.dagger:dagger-compiler:2.44.2'
}