Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven和Android-找不到符号_Java_Android_Maven - Fatal编程技术网

Java Maven和Android-找不到符号

Java Maven和Android-找不到符号,java,android,maven,Java,Android,Maven,我在项目根目录中的pom.xml中有以下构建配置: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.ap

我在项目根目录中的
pom.xml
中有以下构建配置:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0   http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.project.math</groupId>
   <artifactId>android-math-project</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>apk</packaging>
   <name>Math App Android App</name>
   <dependencies>
      <dependency>
         <groupId>com.google.android</groupId>
         <artifactId>android</artifactId>
         <version>4.1.1.4</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>com.google.code.gson</groupId>
         <artifactId>gson</artifactId>
         <version>2.2.4</version>
      </dependency>
      <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <version>1.2.17</version>
      </dependency>
      <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpclient</artifactId>
         <version>4.3.1</version>
      </dependency>
      <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpcore</artifactId>
         <version>4.3.1</version>
      </dependency>
      <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpmime</artifactId>
         <version>4.3.1</version>
      </dependency>
   </dependencies>
   <build>
      <finalName>${project.artifactId}</finalName>
      <sourceDirectory>src</sourceDirectory>
      <pluginManagement>
         <plugins>
            <plugin>
               <groupId>com.jayway.maven.plugins.android.generation2</groupId>
               <artifactId>android-maven-plugin</artifactId>
               <version>3.8.2</version>
               <extensions>true</extensions>
            </plugin>
         </plugins>
      </pluginManagement>
      <plugins>
         <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
               <sdk>
                  <platform>17</platform>
               </sdk>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>

我认为错误来自API版本,但由于Jelly Bean支持
@JavascriptInterface
,所以我不知道是什么情况…

您需要找到另一个注释依赖项,因为com.google.android:android:4.1.1.4不包含任何名为
JavascriptInterface
(com.google.android:annotations:4.1.1.4)


这将为您提供所有包含
JavascriptInterface

的JAR。您找到解决方案了吗?我遇到了完全相同的问题,但什么也没找到。。。
[INFO] 6 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.059s
[INFO] Finished at: Tue Jan 07 19:33:06 EET 2014
[INFO] Final Memory: 18M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project android-math-app: Compilation failure: Compilation failure:
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[23,22] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: package android.webkit
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[38,10] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: class com.app.math.apwebview.ApWebViewJSInterface
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[44,10] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: class com.app.math.apwebview.ApWebViewJSInterface
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[49,10] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: class com.app.math.apwebview.ApWebViewJSInterface
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[61,10] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: class com.app.math.apwebview.ApWebViewJSInterface
[ERROR] /Users/user/Projects/Math-Project-Appp/android-math-app/src/com/app/math/apwebview/ApWebViewJSInterface.java:[68,10] cannot find symbol
[ERROR] symbol  : class JavascriptInterface
[ERROR] location: class com.app.math.apwebview.ApWebViewJSInterface
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException