【问题标题】:class file not found找不到类文件
【发布时间】:2018-05-20 12:45:39
【问题描述】:

我刚刚关闭我的项目并重新打开它,现在我面临新的错误!

错误:无法访问 TintableImageSourceView 类文件 找不到 android.support.v4.widget.TintableImageSourceView

似乎这条线出现了错误,但我真的不知道为什么:

 LottieAnimationView animationView = (LottieAnimationView) dialog.findViewById(R.id.animation_view);
            //  overlay = (RelativeLayout) dialog.findViewById(R.id.overlay);
            animationView.setImageAssetDelegate(new ImageAssetDelegate() {
                @Override
                public Bitmap fetchBitmap(LottieImageAsset asset) {
                    AssetManager assetManager = context.getAssets();
                    InputStream istr;
                    Bitmap bitmap = null;
                    try {
                        istr = assetManager.open(asset.getFileName());
                        bitmap = BitmapFactory.decodeStream(istr);
                    } catch (IOException e) {
                        // handle exception
                    }
                    return bitmap;
                }
            });
            animationView.setAnimation("data.json");
            animationView.loop(true);

正如我所说,项目昨天工作正常,直到今天我的代码没有任何变化!我今天才重新打开它。

编辑: 应用 gradle.build

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias '...'
            keyPassword '...'
            storeFile file('...')
            storePassword '...'
        }
    }
    compileSdkVersion 25
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "ymz.yma.setareitsim_seller"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 5
        versionName "1.0"
        manifestPlaceholders = [onesignal_app_id               : "...",
                                onesignal_google_project_number: "REMOTE"]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable true
            signingConfig signingConfigs.config
        }
        debug{
            signingConfig signingConfigs.config
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'com.wrapp.floatlabelededittext:library:0.0.6'
    compile 'com.daimajia.easing:library:2.1@aar'
    compile 'com.daimajia.androidanimations:library:2.3@aar'
    compile 'com.truizlop.fabreveallayout:library:1.0.0'
    // compile 'com.bartoszlipinski.flippablestackview:library:1.2.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.ramotion.foldingcell:folding-cell:1.2.1'
    compile 'com.android.support:design:25.4.0'
    compile 'com.mikhaellopez:circularprogressbar:1.1.1'
    compile 'com.github.zcweng:switch-button:0.0.3@aar'
    compile 'com.github.devlight.navigationtabstrip:navigationtabstrip:1.0.4'
    compile 'com.roger.psdloadingview.library:Library:1.0.1'
    compile 'jp.wasabeef:blurry:2.1.1'
    compile 'com.orhanobut:dialogplus:1.11@aar'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.airbnb.android:lottie:2.1.0'
    compile 'com.github.takusemba:spotlight:1.1.3'
    compile('com.github.badoualy:stepper-indicator:1.0.7') { exclude group: 'com.android.support' }
    compile('com.github.ganfra:material-spinner:2.0.0') {
        exclude group: 'com.android.support'
    }
    compile 'me.gujun.android.taggroup:library:1.4@aar'
    compile('com.alibaba.android:ultraviewpager:1.0.6.1@aar') {
        transitive = true
    }
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    compile 'com.orhanobut:hawk:2.0.1'
    compile 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
    compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    compile 'com.github.iwgang:countdownview:2.1.6'
    // compile 'nl.psdcompany:duo-navigation-drawer:2.0.7'
    implementation project(':sep')
}

P.S:我已将 android studio 更新到最新版本,使缓存无效并清理项目但无法正常工作!

解决了!

解决方案: 我刚刚关闭了电脑并让它走了。启动电脑并重新打开项目后问题已修复!我花了一整天的时间。

【问题讨论】:

  • 发布项目的 gradle 文件以及 gradle 根文件。
  • @jantursky 我编辑了我的问题
  • 尝试更新到最新的 SDK 版本,即使使用以下库:compileSdkVersion 27 buildToolsVersion "27.0.3" dependencies { implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com .android.support:support-v4:27.1.1' 实现 'com.android.support:recyclerview-v7:27.1.1' 实现'com.android.support:design:27.1.1' }

标签: java android gradle


【解决方案1】:

尝试清理并重建项目

【讨论】:

  • 感谢您的回复,我已清理、重建、无效和清理缓存!不工作:(
【解决方案2】:

我已经遇到了这种类型的问题,并且为我解决了这个问题。
只需在 Android Studio 中点击:File -> Invalidate Caches / Restart...
重启和索引后,希望一切正常。

你也可以Build -> Clean Project然后Build -> Rebuild Project

【讨论】:

  • 哦,我明白了,现在我发现 android studio 再次打开时似乎出现了一些错误。但对我来说,我完成了这些任务并且工作得很好。
猜你喜欢
  • 1970-01-01
  • 2021-10-08
  • 2021-02-20
  • 2017-12-10
  • 2018-06-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多