简体   繁体   English

在 package 中找到 0 个测试类 Android Studio 中的“可绘制”错误

[英]0 test classes found in package 'drawable' Error in Android Studio

I find an issue when running my project in android studio what i see when i try to run is我在 android 工作室中运行我的项目时发现一个问题,我在尝试运行时看到的是

 0 test classes found in package 'drawable'

 Process finished with exit code -1
 Empty test suite.

Though I have searched for this issue I couldn't find a solution I even tried to invalidate cache and restart the project but still it doesn't works.虽然我已经搜索过这个问题,但我找不到解决方案,我什至尝试使缓存无效并重新启动项目,但它仍然不起作用。 This issue is only being caused for only this particular project however for a new project i make everything works smooth.此问题仅针对此特定项目引起,但是对于新项目,我使一切顺利进行。

My gradle file我的 gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.jiit.minor2.shubhamjoshi.human"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:design:24.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'org.jsoup:jsoup:1.8.3'
    compile 'com.firebase:firebase-client-android:2.5.2+'
    compile 'com.github.amlcurran.showcaseview:library:5.4.3'
    compile 'com.firebaseui:firebase-ui:0.3.1'
    compile files('libs/twitter4j-core-4.0.4.jar')
}

My project structure我的项目结构

我的项目结构

Thanks In advance.提前致谢。

There is nothing wrong with your project. 您的项目没有任何问题。 This is happening because you are trying to run drawable in app. 这种情况正在发生,因为您正试图在应用程序中运行drawable。 From the drop down select app and then run. 从下拉选择应用程序然后运行。 It will be OK. 一切都会安好的。

应用配置

It's not erroring just misconfigurations. 这不是错误配置错误。 Just select the app and then run. 只需选择应用程序然后运行即可。 It will be OK. 一切都会安好的。

I've just had the same error but because my unit-test files were not in the src/test/java directory (used to be fine in there). 我刚刚遇到了同样的错误,但因为我的单元测试文件不在src/test/java目录中(以前就好了)。

Moving the test class files out of their local source directory and into the test one solved it (including a small amount of refactoring to import the classes that required testing). 将测试类文件移出其本地源目录并进入测试版解决了它(包括少量重构以导入需要测试的类)。

For Android Studio's android-tests (not unit-tests), run in bash:对于 Android Studio 的 android-tests(不是单元测试),在 bash 中运行:

./gradlew :createDebugAndroidTestCoverageReport --continue

Which shows actual problem, instead of just not found.这显示了实际问题,而不仅仅是未找到。

For me actual error was:对我来说,实际错误是:

 error: class ActivitySignInTest is public, should be declared in a file named ActivitySignInTest.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当“重新运行失败的测试”时,Android Studio“在包中找到0个测试类” - Android Studio “0 test classes found in package” when “rerun failed tests” 找不到与@ drawable / test err android studio匹配的资源 - No resource found that matches @drawable/test err android studio Android Studio找不到资源@drawable - Android Studio No resource found @drawable Android Studio“找不到以下类”错误 - Android Studio “The following classes could not be found” error 在 Android Studio 的插件中找不到 Android 可绘制导入器 - Android Drawable Importer not found in plugins in Android Studio 更新Android Studio和支持库后找不到drawable / abc_vector_test - drawable/abc_vector_test not found after updating Android Studio and the Support Library 在Android Studio中构建项目时出错“错误:找不到与给定名称匹配的资源(在____处使用值&#39;@ drawable / <name> “) - Error Building Project in Android Studio "Error: No resource found that matches the given name (at ____ with value '@drawable/<name>') android studio错误包找不到? 还有一些错误? - android studio error package can not found ? and some error? Android Studio中的包装错误 - Package error in android studio 找不到Android Studio appcompat drawable-hdpi-v4资源 - Android Studio appcompat drawable-hdpi-v4 resources not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM