我遇到了从服务器构建的问题。我的项目是使用Netbeans IDE的Android应用程序。当我运行我的应用程序一切正常时,编译器报告根本没有错误。但是当我发送服务器构建Netbeans报告成功构建但是当我登录到构建服务器时,我看到有一个构建失败并带有错误日志。
以下是我从构建服务器获取的错误日志:
Executing: /home/ec2-user/android-sdk/tools/android create project --target android-14 --name MyApplication --path /tmp/build4676848571336833460xxx/MyApplication --activity MyApplicationStub --package com.mycompany.myapp Created directory /tmp/build4676848571336833460xxx/MyApplication/src/com/mycompany/myapp
Added file /tmp/build4676848571336833460xxx/MyApplication/src/com/mycompany/myapp/MyApplicationStub.java
Created directory /tmp/build4676848571336833460xxx/MyApplication/res
Created directory /tmp/build4676848571336833460xxx/MyApplication/bin
Created directory /tmp/build4676848571336833460xxx/MyApplication/libs
Created directory /tmp/build4676848571336833460xxx/MyApplication/res/values
Added file /tmp/build4676848571336833460xxx/MyApplication/res/values/strings.xml
Created directory /tmp/build4676848571336833460xxx/MyApplication/res/layout
Added file /tmp/build4676848571336833460xxx/MyApplication/res/layout/main.xml
Created directory /tmp/build4676848571336833460xxx/MyApplication/res/drawable-hdpi
Created directory /tmp/build4676848571336833460xxx/MyApplication/res/drawable-mdpi
Created directory /tmp/build4676848571336833460xxx/MyApplication/res/drawable-ldpi
Added file /tmp/build4676848571336833460xxx/MyApplication/AndroidManifest.xml
Added file /tmp/build4676848571336833460xxx/MyApplication/build.xml
Added file /tmp/build4676848571336833460xxx/MyApplication/proguard-project.txt
Executing: /home/ec2-user/android/ant/bin/ant release Buildfile: /tmp/build4676848571336833460xxx/MyApplication/build.xml
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
[echo] proguard.config is proguard.cfg
[echo] Proguard.config is enabled
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 22.2.1
[checkenv] Installed at /home/ec2-user/android-sdk
-setup:
[echo] Project Name: MyApplication
[gettype] Project Type: Application
-build-setup:
[getbuildtools] Using latest Build Tools: 18.1.1
[echo] Resolving Build Target for MyApplication...
[gettarget] Project Target: Android 4.0
[gettarget] API level: 14
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/bin/res
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/bin/rsObj
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/bin/rsLibs
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/gen
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/bin/classes
[mkdir] Created dir: /tmp/build4676848571336833460xxx/MyApplication/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for MyApplication...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with 'release'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 405 source files to /tmp/build4676848571336833460xxx/MyApplication/bin/classes
[javac] /tmp/build4676848571336833460xxx/MyApplication/src/com/mycompany/myapp/MyApplicationStub.java:119: error: unreported exception IOException; must be caught or declared to be thrown
[javac] i.start();
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
建立失败 /home/ec2-user/android-sdk/tools/ant/build.xml:720:执行此行时发生以下错误: /home/ec2-user/android-sdk/tools/ant/build.xml:734:编译失败;有关详细信息,请参阅编译器错误输出。
总时间:26秒
答案 0 :(得分:1)
不要向throws
回调添加异常start()
语句。