I am trying to build an android project on apple silicon with Android studio Artic Fox.
But Project is not building. I tried like hundred times changing the room version but its not working. Here are the dependencies I am using so far:
minSdkVersion = 21
targetSdkVersion = 30
compileSdkVersion = 30
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
kotlinVersion = '1.5.30'
nstack_version = '3.2.8'
// Library versions
dagger_version = '2.29.1'
leak_canary_version = '1.6.3'
okhttp_version = '4.9.0'
moshi_version = '1.11.0'
retrofit_version = '2.9.0'
lifecycle_version = "2.2.0"
room_version = '2.4.0-alpha04'
work_version = '2.4.0'
navigation_version = '2.3.1'
glide_version = '4.11.0'
billing_version = '3.0.1'
coroutines_version = '1.5.2'
exoplayer_version = '2.14.0'
// Library implementations
androidxCore = "androidx.core:core-ktx:1.3.1"
androidxCoreRuntime = "androidx.arch.core:core-runtime:2.1.0"
androidxAnnotations = "androidx.annotation:annotation:1.1.0"
androidxSecurity = "androidx.security:security-crypto:1.0.0-rc03"
androidxExifInterface = "androidx.exifinterface:exifinterface:1.2.0"
androidxPreference = "androidx.preference:preference:1.1.1"
// Work manager
workManagerKtx = "androidx.work:work-runtime-ktx:$work_version"
workManagerRx = "androidx.work:work-rxjava2:$work_version"
// Test helpers
workManagerTesting = "androidx.work:work-testing:$work_version"
// Coroutines
coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
coroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
// RX
rx = "io.reactivex.rxjava2:rxjava:2.2.19"
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.1.1"
rxKotlin = 'io.reactivex.rxjava2:rxkotlin:2.4.0'
rxLint = 'nl.littlerobots.rxlint:rxlint:1.7.5'
// Network
okhttp = "com.squareup.okhttp3:okhttp:$okhttp_version"
okhttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
retrofit = "com.squareup.retrofit2:retrofit:$retrofit_version"
retrofitRx = "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
retrofitGson = "com.squareup.retrofit2:converter-gson:2.9.0"
moshi = "com.squareup.moshi:moshi:$moshi_version"
moshiCodegen = "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
moshiAdapters = "com.squareup.moshi:moshi-adapters:$moshi_version"
retrofitMoshi = "com.squareup.retrofit2:converter-moshi:$retrofit_version"
// Room
room = "androidx.room:room-runtime:$room_version"
roomCompiler = "androidx.room:room-compiler:$room_version"
roomRx = "androidx.room:room-rxjava2:$room_version" // optional - RxJava support for Room
roomCo = "androidx.room:room-ktx:$room_version"
roomTesting = "androidx.room:room-testing:$room_version" // Test helpers
// Dagger
dagger = "com.google.dagger:dagger:${dagger_version}"
daggerCompiler = "com.google.dagger:dagger-compiler:${dagger_version}"
daggerAnnotation = 'org.glassfish:javax.annotation:10.0-b28'
// Dates and time
threetenabp = 'com.jakewharton.threetenabp:threetenabp:1.2.4'
threetenabpTest = 'org.threeten:threetenbp:1.4.5'
// Utilities
aTool = 'dk.eleknet.git.elek:aTool:1.1.0'
gson = 'com.google.code.gson:gson:2.8.6'
//--- Testing ---//
androidTestRunner = "androidx.test.runner.AndroidJUnitRunner"
// Versions
junit_version = '4.12'
mockito_version = '3.2.4'
hamcrest_version = '1.3'
test_runner_version = '1.2.0'
espresso_version = '3.2.0'
// Libraries
junit = "junit:junit:${junit_version}"
mockitoCore = "org.mockito:mockito-core:${mockito_version}"
hamcrest = "org.hamcrest:hamcrest-all:${hamcrest_version}"
mockitoKotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidxTestRules = "androidx.test:rules:$test_runner_version"
androidxJunit = "androidx.test.ext:junit:1.1.1"
espressoCore = "androidx.test.espresso:espresso-core:$espresso_version"
espressoIntents = "androidx.test.espresso:espresso-intents:$espresso_version"
espressoContrib = "androidx.test.espresso:espresso-contrib:$espresso_version"
mockitoAndroid = "org.mockito:mockito-android:$mockito_version"
coreTesting = "androidx.arch.core:core-testing:2.0.1"
mockWebserver = "com.squareup.okhttp3:mockwebserver:$okhttp_version"
workTesting = "android.arch.work:work-testing:$work_version"
androidxOrchestrator = "androidx.test:orchestrator:$test_runner_version"
// Exoplayer
exoplayerCore = "com.google.android.exoplayer:exoplayer-core:${exoplayer_version}"
exoplayerUi = "com.google.android.exoplayer:exoplayer-ui:${exoplayer_version}"
exoPlayerExtentsionCast = "com.google.android.exoplayer:extension-cast:${exoplayer_version}"
exoPlayerExtentsionMediaSession = "com.google.android.exoplayer:extension-mediasession:${exoplayer_version}"
Here is my project level build.gradle file
apply plugin: "com.github.ben-manes.versions"
buildscript {
apply from: 'dependencies.gradle'
repositories {
google()
maven {
url 'https://maven.fabric.io/public'
}
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "dk.nodes.nstack:translation:$nstack_version"
classpath "dk.nodes.ci:bitrise:1.0"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
classpath 'com.google.firebase:perf-plugin:1.3.2'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
classpath "com.github.ben-manes:gradle-versions-plugin:0.33.0"
}
}
allprojects {
apply from: "$rootDir/code-check/ktlint.gradle"
apply from: "$rootDir/code-check/detekt.gradle"
repositories {
google()
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
jcenter()
maven { url "https://mobilesdk.useinsider.com/android" }
}
afterEvaluate {
project.apply plugin: 'com.github.ben-manes.versions'
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d- ]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
The exception I am getting right now is this:
Execution failed for task ':data:kaptProdDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights
What can I do to build successfully this project on apple silicon?
CodePudding user response:
With the below dependencies I was able to build project successfully:
kotlinVersion = '1.4.20'
nstack_version = '3.2.8'
// Library versions
dagger_version = '2.29.1'
leak_canary_version = '1.6.3'
okhttp_version = '4.9.0'
moshi_version = '1.11.0'
retrofit_version = '2.9.0'
lifecycle_version = "2.2.0"
room_version = '2.4.0-alpha04'
work_version = '2.4.0'
navigation_version = '2.3.1'
glide_version = '4.11.0'
billing_version = '3.0.1'
coroutines_version = '1.4.3'
exoplayer_version = '2.14.0'