我正在尝试从 Eclipse 迁移到 Android studio 以进行Android应用开发。但是很难配置它。
提取下载的android-studio我把它放到/usr/local
。然后创建了一个新项目。但
以下导入无法识别。
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
Add2Wallet/
├── Add2Wallet
│ ├── Add2Wallet-Add2Wallet.iml
│ ├── build.gradle
│ ├── proguard-rules.txt
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── com
│ │ └── zazzercode
│ │ └── add2wallet
│ │ └── Add2WalletView.java
│ └── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_add2_wallet_view.xml
│ │ └── fragment_add2_wallet_view.xml
│ ├── menu
│ │ └── add2_wallet_view.xml
│ ├── values
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── values-w820dp
│ └── dimens.xml
├── Add2Wallet.iml
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
└── settings.gradle
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/usr/local/android-studio/sdk
1 buildscript {
2 repositories {
3 mavenCentral()
4 }
5 dependencies {
6 classpath 'com.android.tools.build:gradle:0.7.+'
7 }
8 }
9 apply plugin: 'android'
10
11 repositories {
12 mavenCentral()
13 }
14
15 android {
16 compileSdkVersion 19
17 buildToolsVersion "19.0.0"
18
19 defaultConfig {
20 minSdkVersion 7
21 targetSdkVersion 19
22 versionCode 1
23 versionName "1.0"
24 }
25 buildTypes {
26 release {
27 runProguard false
28 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
29 }
30 }
31 }
32
33 dependencies {
34 //compile 'com.android.support:support-v4:18.0.+'
35 compile 'com.android.support:appcompat-v7:+'
36 }
在Appcompat / add a library with android studio发现了类似的问题,但解决方案compile 'com.android.support:support-v4:18.0.+'
提供了对我不起作用。
在$ gradlew build
上,我收到以下错误
FAILURE: Build failed with an exception.
* Where:
Build file '/backup/workspace.programming/workspace.android/Add2Wallet/Add2Wallet/build.gradle' line: 9
* What went wrong:
A problem occurred evaluating project ':Add2Wallet'.
> org/gradle/tooling/provider/model/ToolingModelBuilderRegistry
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
另一个问题是当我在 android-studio 中点击Sync Project with Gradle files
时,我收到以下错误
23:08:10 ExternalSystemException
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-all.zip'.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.9/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: cannot create 7���libpthread.so.0_Jv_RegisterClasseslibjli.so__gmon_start__JLI_Launchlibdl.so.2libc.so.6__libc_start_mainlib.so/../lib/amd64/jli:/../jre/lib/amd64/jliSUNWprivate_1.1GLIBC_2.2.5�U/pq�N�%: Directory nonexistent
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: ELF: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 3: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: Syntax error: end of file unexpected (expecting ")")
: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-all.zip'.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.9/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: cannot create 7���libpthread.so.0_Jv_RegisterClasseslibjli.so__gmon_start__JLI_Launchlibdl.so.2libc.so.6__libc_start_mainlib.so/../lib/amd64/jli:/../jre/lib/amd64/jliSUNWprivate_1.1GLIBC_2.2.5�U/pq�N�%: Directory nonexistent
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: ELF: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 3: /usr/java/jdk1.7.0_05/bin/java: �: not found
/usr/java/jdk1.7.0_05/bin/java: 1: /usr/java/jdk1.7.0_05/bin/java: Syntax error: end of file unexpected (expecting ")")
23:08:11 Gradle invocation completed successfully in 0 sec
答案 0 :(得分:1)
似乎V7依赖于V4支持。您不能仅使用V7。 并检查你的android支持库是最新的吗?