Closed sunenielsen closed 7 years ago
That's weird. I did as you said but seem like it worked just fine. This is my configuration:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.kradragon.sampleapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.kaopiz:kprogresshud:1.0.5'
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Using the exact same config (except the application id) I still get the crash. I've tested it on an android 7 device and an android 6 emulator.
Here is my activity:
package com.test.hudtest6;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.kaopiz.kprogresshud.KProgressHUD;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
KProgressHUD.create(MainActivity.this)
.setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
.setLabel("Please wait")
.setDetailsLabel("Downloading data")
.setCancellable(true)
.setAnimationSpeed(2)
.setDimAmount(0.5f)
.show();
}
}
And my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.hudtest6">
<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/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>```
I have uploaded a newer version with some changes. Built with upgraded gradle and build tools.
You can try again to see if it helps.
compile 'com.kaopiz:kprogresshud:1.1.0'
That seems to have fixed the problem. Thank you very much!
You are welcome!
The library seems to have become broken since the last time I used it. I have no idea what has changed. Whenever I show the HUD it crashes the app.
To reproduce, all I have to do is the following:
The result is this error:
java.lang.NoSuchFieldError: No field container of type I in class Lcom/kaopiz/kprogresshud/R$id; or its superclasses (declaration of 'com.kaopiz.kprogresshud.R$id' appears in /data/app/com.rspsystems.hudtest3-1/split_lib_slice_5_apk.apk) at com.kaopiz.kprogresshud.KProgressHUD$ProgressDialog.initViews(KProgressHUD.java:292) at com.kaopiz.kprogresshud.KProgressHUD$ProgressDialog.onCreate(KProgressHUD.java:281) at android.app.Dialog.dispatchOnCreate(Dialog.java:514) at android.app.Dialog.show(Dialog.java:380) at com.kaopiz.kprogresshud.KProgressHUD.show(KProgressHUD.java:233)
(The rest of the strack trace is left out to reduce clutter)
This even happens in an old project I had no problems with half a year ago. Only thing I can think of that has changed since then, is that Android Studio forced me to update gradle from 2.3.0-Beta1 to 2.3.3.