我正在使用 gradle 构建一个 NDK 项目,当 Android Studio 尝试将 apk 放到我的模拟器上时出现错误。它读出 gradle 完成了项目的构建,它只是不会部署到模拟器。这是错误:
null
java.lang.NullPointerException
at com.android.tools.idea.run.tasks.DeployApkTask.perform(DeployApkTask.java:89)
at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:103)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:366)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
而我的主要build.gradle
:
安卓/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/android/android-tools"
}
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.8.0-alpha5'
}
}
allprojects {
repositories {
mavenCentral()
}
}
安卓/应用/
apply plugin: 'com.android.model.application'
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:22.2.0"
}
model {
android {
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
defaultConfig.with {
applicationId = 'com.example.SanAngeles'
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 23
buildConfigFields {
create() {
type "int"
name "VALUE"
value "1"
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
ndk {
moduleName "sanangeles"
stl "stlport_static"
CFlags.add("-I../../common/freetype/include")
CFlags.add("-DANDROID_NDK")
CFlags.add("-DDISABLE_IMPORTGL")
CFlags.add("-DFT2_BUILD_LIBRARY=1")
ldLibs.add("EGL")
ldLibs.add("android")
ldLibs.add("GLESv2")
ldLibs.add("dl")
ldLibs.add("log")
ldLibs.add("mui")
}
sources {
main {
java {
source {
srcDir "src"
}
}
jni {
exportedHeaders {
srcDirs = ["../../common/freetype/include"]
srcDirs += ["../../common/freetype/include/freetype"]
srcDirs += ["../../common/freetype/include/freetype/config"]
}
source {
srcDir "../../common/src"
include "../../common/freetype/src/autofit/autofit.c"
include "../../common/freetype/src/base/basepic.c"
include "../../common/freetype/src/base/ftapi.c"
include "../../common/freetype/src/base/ftbase.c"
include "../../common/freetype/src/base/ftbbox.c"
include "../../common/freetype/src/base/ftbitmap.c"
include "../../common/freetype/src/base/ftdbgmem.c"
include "../../common/freetype/src/base/ftdebug.c"
include "../../common/freetype/src/base/ftglyph.c"
include "../../common/freetype/src/base/ftinit.c"
include "../../common/freetype/src/base/ftpic.c"
include "../../common/freetype/src/base/ftstroke.c"
include "../../common/freetype/src/base/ftsynth.c"
include "../../common/freetype/src/base/ftsystem.c"
include "../../common/freetype/src/cff/cff.c"
include "../../common/freetype/src/pshinter/pshinter.c"
include "../../common/freetype/src/pshinter/pshglob.c"
include "../../common/freetype/src/pshinter/pshpic.c"
include "../../common/freetype/src/pshinter/pshrec.c"
include "../../common/freetype/src/psnames/psnames.c"
include "../../common/freetype/src/psnames/pspic.c"
include "../../common/freetype/src/raster/raster.c"
include "../../common/freetype/src/raster/rastpic.c"
include "../../common/freetype/src/sfnt/pngshim.c"
include "../../common/freetype/src/sfnt/sfntpic.c"
include "../../common/freetype/src/sfnt/ttbdf.c"
include "../../common/freetype/src/sfnt/ttkern.c"
include "../../common/freetype/src/sfnt/ttload.c"
include "../../common/freetype/src/sfnt/ttmtx.c"
include "../../common/freetype/src/sfnt/ttpost.c"
include "../../common/freetype/src/sfnt/ttsbit.c"
include "../../common/freetype/src/sfnt/sfobjs.c"
include "../../common/freetype/src/sfnt/ttcmap.c"
include "../../common/freetype/src/sfnt/sfdriver.c"
include "../../common/freetype/src/smooth/smooth.c"
include "../../common/freetype/src/smooth/ftspic.c"
include "../../common/freetype/src/truetype/truetype.c"
include "../../common/freetype/src/type1/t1driver.c"
include "../../common/freetype/src/cid/cidgload.c"
include "../../common/freetype/src/cid/cidload.c"
include "../../common/freetype/src/cid/cidobjs.c"
include "../../common/freetype/src/cid/cidparse.c"
include "../../common/freetype/src/cid/cidriver.c"
include "../../common/freetype/src/pfr/pfr.c"
include "../../common/freetype/src/pfr/pfrgload.c"
include "../../common/freetype/src/pfr/pfrload.c"
include "../../common/freetype/src/pfr/pfrobjs.c"
include "../../common/freetype/src/pfr/pfrsbit.c"
include "../../common/freetype/src/type42/t42objs.c"
include "../../common/freetype/src/type42/t42parse.c"
include "../../common/freetype/src/type42/type42.c"
include "../../common/freetype/src/winfonts/winfnt.c"
include "../../common/freetype/src/pcf/pcfread.c"
include "../../common/freetype/src/pcf/pcfutil.c"
include "../../common/freetype/src/pcf/pcfdrivr.c"
include "../../common/freetype/src/psaux/afmparse.c"
include "../../common/freetype/src/psaux/psaux.c"
include "../../common/freetype/src/psaux/psconv.c"
include "../../common/freetype/src/psaux/psobjs.c"
include "../../common/freetype/src/psaux/t1decode.c"
include "../../common/freetype/src/tools/apinames.c"
include "../../common/freetype/src/type1/t1afm.c"
include "../../common/freetype/src/type1/t1gload.c"
include "../../common/freetype/src/type1/t1load.c"
include "../../common/freetype/src/type1/t1objs.c"
include "../../common/freetype/src/type1/t1parse."
include "../../common/freetype/src/bdf/bdfdrivr."
include "../../common/freetype/src/bdf/bdflib."
include "../../common/freetype/src/gzip/ftgzip."
include "../../common/freetype/src/lzw/ftlzw.c"
}
}
}
}
}
}