从git中提取离子源代码后,无法在本地运行代码

时间:2018-08-31 08:15:26

标签: git cordova ionic-framework

所以我有一个问题,每当我使用得到的克隆 url

从git克隆离子源代码时

然后使用ionic cordova运行android在visual studio代码中运行代码,我得到以下错误>

C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:72: error: strings in switch are not supported in -source 1.6
    switch(action) {
          ^
  (use -source 7 or higher to enable strings in switch)
C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:144: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:201: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Ionic Projects\PPAppHub2\platforms\android\src\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

27 actionable tasks: 1 executed, 26 up-to-date
BUILD FAILED in 2s
(node:8376) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:72: error: strings in switch are not supported in -source 1.6
    switch(action) {
          ^
  (use -source 7 or higher to enable strings in switch)
C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:144: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
C:\Ionic Projects\PPAppHub2\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:201: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Ionic Projects\PPAppHub2\platforms\android\src\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
    at ChildProcess.whenDone (C:\Ionic Projects\PPAppHub2\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at ChildProcess.emit (events.js:160:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:8376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS C:\Ionic Projects\PPAppHub2>

我已经尝试运行npm install,将ionic cordova platfrom删除android并使用ionic cordova platform重新添加它,但没有运气添加android。谁能提供一些建议?

0 个答案:

没有答案