1. Android Studio2.2在mac下啟動報錯
找不到原因,改為使用Android Studio 2.1.3
下載地址:http://tools.android.com/download/studio/builds/2-1-3
2. 編譯某項目報錯Could not find property 'config' on SigningConfig container
在build.grade文件的android->signingConfigs節(jié)點下增加config配置
...
3. 編譯報錯failed to find target android-22
修改build.grade文件的相關(guān)屬性:
找不到原因,改為使用Android Studio 2.1.3
下載地址:http://tools.android.com/download/studio/builds/2-1-3
2. 編譯某項目報錯Could not find property 'config' on SigningConfig container
在build.grade文件的android->signingConfigs節(jié)點下增加config配置
android {
signingConfigs {
config {
keyAlias '你的key別名'
keyPassword '你的key密碼'
storeFile file('你的密鑰存儲路徑')
storePassword '你的存儲密碼'
}
} ...
3. 編譯報錯failed to find target android-22
/Users/username/Library/Android/sdk/platforms下發(fā)現(xiàn)有android-24目錄,故將編譯級別都設(shè)為24。
compileSdkVersion 24
buildToolsVersion "24.0.0"
targetSdkVersion 24
compile 'com.android.support:appcompat-v7:24.0.0'
4. 編譯報錯Gradle sync failed: Gradle DSL method not found: 'android()'
刪除項目根目錄下的build.gradle文件,因為app目錄下已經(jīng)有build.gradle了。
備份下根目錄下build.gradle文件的內(nèi)容:
5. 編譯報錯Plugin with id 'com.android.application' not found
4. 編譯報錯Gradle sync failed: Gradle DSL method not found: 'android()'
刪除項目根目錄下的build.gradle文件,因為app目錄下已經(jīng)有build.gradle了。
備份下根目錄下build.gradle文件的內(nèi)容:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 24
}
dependencies {
}
5. 編譯報錯Plugin with id 'com.android.application' not found
恢復(fù)項目根目錄下的build.gradle文件,將內(nèi)容修改為如下:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
6. 編譯報錯:failed to find Build Tools revision 24.0.0
6. 編譯報錯:failed to find Build Tools revision 24.0.0
/Users/username/Library/Android/sdk/build-tools下查看自己的BuildTools版本,發(fā)現(xiàn)是24.0.3,然后將buildToolsVersion修改為該版本:
buildToolsVersion "24.0.3"
7. Android Studio編譯執(zhí)行以下任務(wù)時一直等待,執(zhí)行了一個小時也沒動靜。
buildToolsVersion "24.0.3"
7. Android Studio編譯執(zhí)行以下任務(wù)時一直等待,執(zhí)行了一個小時也沒動靜。
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar]
打開Preferences->Build-Excecution-Deployment->BuildTools->Gradle,勾選Offline work
參見http://stackoverflow.com/questions/25629368/how-to-fix-android-studio-getting-stuck-executing-gradle-tasks
8. Exception in thread "png-cruncher_5" java.lang.RuntimeException: Timed out while waiting for slave aapt process
不知道原因,最終是通過修改SDK Build Tools為19.1.0、升級JDK由JDK7升至JDK8、增加環(huán)境變量SLAVE_AAPT_TIMEOUT=30等搞定的
9. 如何修改SDK和JDK的路徑
在File->Project Structure里修改
10. 修改Android Studio中java代碼的編譯級別
11.如何在使用gradle時增加--stacktrace參數(shù)
參見http://stackoverflow.com/questions/25629368/how-to-fix-android-studio-getting-stuck-executing-gradle-tasks
8. Exception in thread "png-cruncher_5" java.lang.RuntimeException: Timed out while waiting for slave aapt process
不知道原因,最終是通過修改SDK Build Tools為19.1.0、升級JDK由JDK7升至JDK8、增加環(huán)境變量SLAVE_AAPT_TIMEOUT=30等搞定的
9. 如何修改SDK和JDK的路徑
在File->Project Structure里修改
10. 修改Android Studio中java代碼的編譯級別
打開File --> Project Structure-->app,修改Source Compatibility和Target Compatibility
11.如何在使用gradle時增加--stacktrace參數(shù)
Preferences->Build-Excecution-Deployment->Compiler
12. 報錯aapt ..finished with non- zero exit value 1
找不到原因,增加編譯參數(shù)--info后發(fā)現(xiàn)有用的信息:invalid resource directory name: ..app\build\intermediates\res\merged\debug/values-b+sr+Latn
13.invalid resource directory name: ..app\build\intermediates\res\merged\debug/values-b+sr+Latn
不知道原因,將版本升級到21解決了。
在工具欄里點擊“Sync Project with Gradle Files”按鈕
16.導(dǎo)入某項目時報錯Error:Gradle version 2.14.1 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in...
打開Android Studio的File->Project Structure,點擊Project,將Gradle version修改為2.14.1
25.如何修改生成的apk的名字
增加--info或--debug,在解決報錯時能看到更多的信息
12. 報錯aapt ..finished with non- zero exit value 1
找不到原因,增加編譯參數(shù)--info后發(fā)現(xiàn)有用的信息:invalid resource directory name: ..app\build\intermediates\res\merged\debug/values-b+sr+Latn
13.invalid resource directory name: ..app\build\intermediates\res\merged\debug/values-b+sr+Latn
不知道原因,將版本升級到21解決了。
14. 編譯時報找不到AppCompatActivity類的錯誤
改為使用:compile 'com.android.support:appcompat-v7:22.2.1'
同時將版本由21升級到22
15. 生成apk時報錯:Missing Gradle Project Information. Please check if the IDE successfully synchronized its state with the Gradle Project Model
同時將版本由21升級到22
15. 生成apk時報錯:Missing Gradle Project Information. Please check if the IDE successfully synchronized its state with the Gradle Project Model
16.導(dǎo)入某項目時報錯Error:Gradle version 2.14.1 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in...
打開Android Studio的File->Project Structure,點擊Project,將Gradle version修改為2.14.1
在/Applications/Android Studio.app/Contents/gradle下的確只有g(shù)radle-2.14.1
25.如何修改生成的apk的名字
http://www.jianshu.com/p/93051c9e97fb
Android Studio如何發(fā)布APK:http://chenfeicqq.iteye.com/blog/1889160
26. 在gradle.properties中增加android.enableBuildCache=true,貌似能加快編譯速度。
26. 在gradle.properties中增加android.enableBuildCache=true,貌似能加快編譯速度。