无法使用build.grandle在Android中安装Volley
我是Android新手。现在我正在学习Android截击HTTP库。但当我使用build.grandle安装时,它将Java类添加到libs文件夹中。但它正在抛出错误,无法运行该项目 我将compile'com.mcxiaoke.volley:library:1.0.19'添加到grandle文件中无法使用build.grandle在Android中安装Volley,android,android-volley,Android,Android Volley,我是Android新手。现在我正在学习Android截击HTTP库。但当我使用build.grandle安装时,它将Java类添加到libs文件夹中。但它正在抛出错误,无法运行该项目 我将compile'com.mcxiaoke.volley:library:1.0.19'添加到grandle文件中 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.blog.waiyanhein.llks.llks"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
这是我的大档案
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.blog.waiyanhein.llks.llks"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
所以我试着通过运行应用程序来更新。它安装了所需的文件。但当它即将启动时,会显示此错误,并且应用程序未运行
这是截图
为什么会发生这种情况?试试下面的代码
public class YouApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
在你的成绩中加上
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 23
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
..... // other stuff
compile 'com.android.support:multidex:1.0.1'
}
请提供更多信息
您的图片显示您正在使用Java 8构建android应用程序。您只能使用Java 7构建android应用程序。那么我如何修复此错误呢?在android Studio中,单击
文件
,然后单击项目结构
,然后指定Java SE 7安装的位置,如果您没有安装,请下载最新的Java 7版本。我使用截击和清理项目清除了所有代码。然后再次运行该项目。它现在正在工作。怎么了?上次我用了volley.jar,这是投掷错误。然后我关闭并再次打开android studio。错误消失了。所以我不认为这是与截击有关的错误。确保您有一个活动的internet连接,并且您的Xml文件没有错误。