我有一个Android项目,我试图运行使用AndroidStudio的Instrumentation测试,但是当我尝试运行测试的整个类文件时,我得到以下例外:
java.lang.TypeNotPresentException: Type android.support.test.runner.AndroidJUnit4 not present
Caused by: java.lang.ClassNotFoundException: android.support.test.runner.AndroidJUnit4
Run Code Online (Sandbox Code Playgroud)
有趣的是,我可以在这个Instrument Test类中运行单独的方法,而不是整个类.我的应用程序的build.gradle文件如下:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
lintOptions {
abortOnError false
}
compileSdkVersion 28
defaultConfig {
applicationId "com.sarpuner.journal"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
}
repositories {
maven { url "https://dl.bintray.com/ijabz/maven" }
}
dependencies {
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc01' …Run Code Online (Sandbox Code Playgroud) 我试图演示缓冲区溢出,我希望覆盖一个本地变量gets.我用gcc编译了我的程序-fno-stack-protector,所以我知道使用的缓冲区gets就在我试图覆盖的另一个局部变量的旁边.我的目标是溢出缓冲区并覆盖相邻变量,以便它们都具有相同的字符串.但是,我注意到我需要能够输入'\0'字符,以便strcmp实际显示两者都相等.我怎么输入'\0'?