我真的很难为Android构建Ionic
系统信息
Cordova CLI: 5.3.3
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v0.12.6
Xcode version: Xcode 7.0.1 Build version 7A1001
当我跑步时
$ ionic build android
它产生
Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/010_add_platform_class.js /Users/umer/Workspace/Ionic/blank
add to body class: platform-android
Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/umer/Workspace/Ionic/blank
Running command: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build
ANDROID_HOME=/Users/umer/Documents/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
Running: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew cdvBuildDebug -b /Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle -Dorg.gradle.daemon=true
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /var/root/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
/Users/umer/Workspace/Ionic/blank/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
我尝试更改var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
以将其指向本地分发,但它不会查看指定的路径,而是查看项目的android目录。
使用Ant构建时
cordova build android -- --ant
它构建成功,但我无法构建文档建议的方式。
我已经跟着了 ionic build android error when download gradle
答案 0 :(得分:2)
当我多次运行android命令时出现此错误。我跑了(在Linux上):
public class PodcastListFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
// property variables here
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
.
.
.
refresher = (SwipeRefreshLayout)view.findViewById(R.id.swipe_refresh_layout);
refresher.setOnRefreshListener(this);
return view;
}
@Override
public void onRefresh() {
refreshListView();
}
}
.
.
.
}
我发现android命令不止一次运行。
我打字
ps aux | grep -i android
似乎android拒绝离子访问gradle。