Calling init() in my kotlin app crashes the app immediately. This is the only particle function I call so far, to test I have all the dependencies. I’m working in kotlin.
I followed the stack trace to the library, where okhttp is unresolved . It is highlighted red, as is every http parsing function in the library itself. Is the Android SDK setup page up to date? The repo hasn’t been touched in quite a while.
Reverting to 0.5.1 has the app working, but I would really like to use the newest SDK.
My build.gradle file:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.secrets_gradle_plugin' version '0.5'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.masterandroid.meg"
minSdkVersion 22
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'io.particle:cloudsdk:0.5.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
}
There are definitely some dependencies that aren’t really needed, I just included everything hoping I would eventually include the required set. I was able to add okhttp3 and reference the broken SDK functions in my main activity just to test if the squareup repo was broken.
My android manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.masterandroid.meg">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MEG">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
</application>
</manifest>
I included the permissions that worked last time I needed the particle API, but they didn’t help with the latest release. I went back to 1.0.0 and the issue remains.
Any ideas what could be going wrong? Thanks everybody!