GVKun编程网logo

Android Studio是否完全支持JDK 1.8?(android studio支持jdk11吗)

11

这篇文章主要围绕AndroidStudio是否完全支持JDK1.8?和androidstudio支持jdk11吗展开,旨在为您提供一份详细的参考资料。我们将全面介绍AndroidStudio是否完全支

这篇文章主要围绕Android Studio是否完全支持JDK 1.8?android studio支持jdk11吗展开,旨在为您提供一份详细的参考资料。我们将全面介绍Android Studio是否完全支持JDK 1.8?的优缺点,解答android studio支持jdk11吗的相关问题,同时也会为您带来Android Emulator 是否包含 Android SDK 或 Android Studio?、Android NDK开发基础 使用Android Studio编写NDK、Android SDK Android NDK Android Studio 官方下载地址、Android SDK Android Studio Android NDK 官方下载地址的实用方法。

本文目录一览:

Android Studio是否完全支持JDK 1.8?(android studio支持jdk11吗)

Android Studio是否完全支持JDK 1.8?(android studio支持jdk11吗)

我刚刚从以前的JDK 1.8.0_33下载了JDK 1.8.0_51,因为我遇到了问题。有一些解决方法可将Jdk
8与Android一起使用,我只是想知道Google是否已在Android Studio中为JDK添加了全面支持?还是应该只使用JDK
1.7?建议将不胜感激。

答案1

小编典典

您应该只使用JDK 1.7。JDK 8中的某些功能尚不支持。

Android Emulator 是否包含 Android SDK 或 Android Studio?

Android Emulator 是否包含 Android SDK 或 Android Studio?

来自Android Emulator release notes

Android 模拟器包含在 Android Studio 中。

25.3.0 之前的模拟器版本作为 Android SDK 工具。

为确保您拥有最新版本,请检查 SDK Manager 更新。

对于 25.3.0 之前的 Android Emulator 版本,请参阅 Android SDK 工具发行说明。

Android NDK开发基础 使用Android Studio编写NDK

Android NDK开发基础 使用Android Studio编写NDK

前情提要
首先我们得学习了Java与C/C++的交互 , 使用Java调用C/C++函数,使用C/C++调Java的方法和创建Java对象等等 。在上个系列中 , 我们使用的是Eclipse与VS进行的开发 , 因为延续的是C语言基础系列的做法 , 所以开发工具未作切换 。 在NDK系列中 , 我们将采用最新的Android Studio进行开发 , 版本是Android studio 2.2 RC 2 , NDK版本采用的是最新的r12b 。

开发环境
工具下载地址 (win)(需要科学上网) :
Android Studio 2.2 RC2 --- Android Studio Download 2.2 RC2
Android NDK r12b --- Android NDK r12b 64bit
Android NDK r12b --- Android NDK r12b 32bit

国内镜像站:
androiddevtools

关于开发环境的说明
因为在Android studio 2.2之前的版本 , 对C/C++支持不是很好 , 也没有语法提示 , 写起来不是很方便 , 构建工具也不是很完整 , 所有采用最新的Android studio 2.2 RC2来进行编写 ,但 , Android studio 2.2 RC2 还是Beta版本 ,所有 , 不建议现在应用到生产环境中 , 等google发布了Stable版本之后再应用 。 目前建议 , 可以使用Eclipse编写.so , 然后应用到现在的生产环境中 。

创建NDK项目

第一步, 创建支持C++的项目

图片描述
C++ support

其他的选项使用默认的即可 。

第二步 , 关联NDK

创建完成之后会报如下错误:

图片描述

ndk r12b

在项目配置中 , 关联NDK之后就会ok

图片描述

config ndk

第三步 , 编写native类及处理方法

在创建项目的时候 , 勾选了C++ support , 项目创建完成之后 , 会自动帮我们生成一个cpp/native-lib.cpp

图片描述

auto create cpp file

你可以不用修改文件名 , 在新建native方法的时候 , 会提示你创建一个C++的JNI函数 , 直接创建就会生成一个JNI函数 , 都不用使用javah生成一个头文件 , 然后再引入头文件了 , 非常之方便 。

图片描述

auto create jni function 1

创建函数:

图片描述

auto create jni function 2

在这里 , 就不使用默认的.cpp文件了 , 我们新建一个.c文件 , 创建了HelloNDK.c文件之后 , Android Studio会提示我们 , 需要在Android.mk/CMakeLists.txt中进行声明 , 这里 , 我们使用默认的CMakeLists.txt建构工具 (创建项目的时候自动生成)。

第四步 , build.gradle配置:
externalNativeBuild {  
  cmake {       
     cppFlags ""       
     // 指定只用clang编译器        
    // Clang是一个C语言、Objective-C、C++语言的轻量级编译器。  
    arguments "-DANDROID_TOOLCHAIN=clang"        
    // 生成.so库的目标平台        
    abiFilters "armeabi-v7a" , "armeabi"    
    }
}
 
// 配置CMakeLists.txt路径
externalNativeBuild { 
   cmake {        
      path "CMakeLists.txt"   
   }
}
第五步 , 修改CMakeLists.txt
add_library( # Sets the name of the library.
             HelloNDK  # 生成的.so库文件名称
 
             # Sets the library as a shared library.
             SHARED
 
             # Provides a relative path to your source file(s).
             # Associated headers in the same location as their source
             # file are automatically included.
             # 需要生成的.so库的文件路径
             src/main/cpp/HelloNDK.c
 )
 
target_link_libraries( # Specifies the target library.
                       # 项目链接的.so库名称
                       HelloNDK
 
                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )
第六步 , 编写native方法,以及C函数
/**
 * Created by Zeno on 2016/9/10.
 *
 * NDK Demo
 */
 
public class HelloNDK {
 
    public static native String sayHelloNDK() ;
 
    static {
        System.loadLibrary("HelloNDK");
    }
}
 
#include <jni.h>
JNIEXPORT jstring JNICALLJava_com_zeno_encryptanddecrypt_ndk_HelloNDK_sayHelloNDK(JNIEnv *env, jclass thiz) {   
     // TODO    
     return (*env)->NewStringUTF(env, "this String come from C ");
}

native方法的编写以及C函数的写法, 我们都非常熟悉了 , 这里就不再解释各自的意义了 。

第七步 , 编译

图片描述
make

编译完成之后 ,我们可以切换到project视图,来查看.so文件
图片描述
make success

第八步 , 运行

图片描述
run

如果使用的是genymotion模拟器 , 这需要在abiFilters加入x86 ,不然项目会运行不起来的 。 当然, 也可以使用一个genymotion的arm插件 , 这样不配置x86也可以运行 。

// 生成.so库的目标平台
abiFilters "armeabi-v7a" , "armeabi" , "x86"

结语
做为Android开发者 , 从最开始的Eclipse开发工具 , 到现在日渐成熟的Android Studio , 还有几乎可以看得见成长的Android System , 我很庆幸 , 从一开始就选择了Android平台 , 从初学Android到现在的日渐深入 , Android在成长 , 我也在成长 。见证了Android从一个丑小鸭变成了 , 一个羽翼渐丰的白天鹅 , 不论从操作系统的易用性和UI友好性 , 它的成长都是有目共睹的 。感谢Android 。
写的不好,有什么不对的地方欢迎来喷,有大佬有不同的见解欢迎一起来探讨交流!

Android SDK Android NDK Android Studio 官方下载地址

Android SDK Android NDK Android Studio 官方下载地址

 如果下载速度很慢或者无法下载,有三种解决方法

1. 忍耐.

2. 使用 P2SP 下载工具,比如迅雷,百度云离线.

3. 你们懂得.

无法在线升级请看下边

sudo vi /etc/hosts

添加

74.125.206.93 dl-ssl.google.com

2014.7

ADT Bundle 
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip

SDK Tools Only
http://dl.google.com/android/android-sdk_r23.0.2-windows.zip
http://dl.google.com/android/installer_r23.0.2-windows.exe
http://dl.google.com/android/android-sdk_r23.0.2-macosx.zip
http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz

Android Studio
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-windows.exe
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-mac.dmg
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-linux.tgz

Android NDK
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r10-cxx-stl-libs-with-debug-info.zip

 

 

2014.6 

Android Studio 0.8

http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-windows.exe
http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-mac.dmg
http://dl.google.com/android/studio/install/0.8.0/android-studio-bundle-135.1245622-linux.tgz

Android SDK only r23

http://dl.google.com/android/android-sdk_r23-windows.zip
http://dl.google.com/android/installer_r23-windows.exe
http://dl.google.com/android/android-sdk_r23-macosx.zip
http://dl.google.com/android/android-sdk_r23-linux.tgz

 ADT Bundle r23

http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140624.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140624.zip
http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140624.zip

Android NDK r9d

http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r9d-cxx-stl-libs-with-debug-info.zip

 

Android NDK r6b

Windows

http://dl.google.com/android/ndk/android-ndk-r6b-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r6b-darwin-x86.tar.bz2

Linux

http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2

 

Android SDK 3.2

Windows

http://dl.google.com/android/android-sdk_r12-windows.zip

http://dl.google.com/android/installer_r12-windows.exe

Mac OS X (intel)

http://dl.google.com/android/android-sdk_r12-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r12-linux_x86.tgz

 

Android NDK r6

Windows

http://dl.google.com/android/ndk/android-ndk-r6-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r6-darwin-x86.tar.bz2

Linux 32/64-bit (x86)

http://dl.google.com/android/ndk/android-ndk-r6-linux-x86.tar.bz2

 

Android SDK 3.1

Windows

http://dl.google.com/android/android-sdk_r11-windows.zip

http://dl.google.com/android/installer_r11-windows.exe

Mac OS X(intel)

http://dl.google.com/android/android-sdk_r11-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r11-linux_x86.tgz

 

Android NDK r5b

Windows

http://dl.google.com/android/ndk/android-ndk-r5b-windows.zip

Mac OS X(intel)

http://dl.google.com/android/ndk/android-ndk-r5b-darwin-x86.tar.bz2

Linux

http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2

 

Android SDK 3.0

Windows

http://dl.google.com/android/installer_r10-windows.exe

http://dl.google.com/android/android-sdk_r10-windows.zip

Mac OS X(intel)

http://dl.google.com/android/android-sdk_r10-mac_x86.zip

Linux(i386)

http://dl.google.com/android/android-sdk_r10-linux_x86.tgz

 

Android SDK 2.3

Windows

http://dl.google.com/android/android-sdk_r08-windows.zip

http://dl.google.com/android/installer_r08-windows.exe

Linux (i386)

http://dl.google.com/android/android-sdk_r08-linux_86.tgz

MAC OS X (intel)

http://dl.google.com/android/android-sdk_r08-mac_86.zip

 

Android NDK r5

Windows

http://dl.google.com/android/ndk/android-ndk-r5-windows.zip

Mac OS X (intel) r5

http://dl.google.com/android/ndk/android-ndk-r5-darwin-x86.tar.bz2

Linux 32/64-bit (x86) r5

http://dl.google.com/android/ndk/android-ndk-r5-linux-x86.tar.bz2


Android SDK Android Studio Android NDK 官方下载地址

Android SDK Android Studio Android NDK 官方下载地址

2014.12
Android Studio
https://dl.google.com/dl/android/studio/install/1.0.1/android-studio-bundle-135.1641136.exe
https://dl.google.com/dl/android/studio/install/1.0.1/android-studio-ide-135.1641136.exe
https://dl.google.com/dl/android/studio/ide-zips/1.0.1/android-studio-ide-135.1641136-windows.zip
https://dl.google.com/dl/android/studio/install/1.0.1/android-studio-ide-1641136.dmg
https://dl.google.com/dl/android/studio/ide-zips/1.0.1/android-studio-ide-135.1641136-linux.zip
SDK Tools only
http://dl.google.com/android/installer_r24.0.2-windows.exe
http://dl.google.com/android/android-sdk_r24.0.2-windows.zip
http://dl.google.com/android/android-sdk_r24.0.2-macosx.zip
http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
NDK
http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86.exe
http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86_64.exe
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86_64.bin
http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86.bin
http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
2014.7.2
ADT Bundle
http://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip
http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip
SDK Tools Only
http://dl.google.com/android/android-sdk_r23.0.2-windows.zip
http://dl.google.com/android/installer_r23.0.2-windows.exe
http://dl.google.com/android/android-sdk_r23.0.2-macosx.zip
http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
Android Studio
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-windows.exe
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-mac.dmg
http://dl.google.com/android/studio/install/0.8.6/android-studio-bundle-135.1339820-linux.tgz
Android NDK
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r10-cxx-stl-libs-with-debug-info.zip
如果下载速度很慢或者无法下载,有三种解决方法
1. 忍耐.
2. 使用 P2SP 下载工具,比如迅雷,百度云离线.
3. 你们懂得.
无法在线升级请看下边
sudo vi /etc/hosts
添加
XXX.XXX.XXX.XXX dl-ssl.google.com
上边的 IP 地址从 http://ping.chinaz.com/ 得到

关于Android Studio是否完全支持JDK 1.8?android studio支持jdk11吗的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于Android Emulator 是否包含 Android SDK 或 Android Studio?、Android NDK开发基础 使用Android Studio编写NDK、Android SDK Android NDK Android Studio 官方下载地址、Android SDK Android Studio Android NDK 官方下载地址等相关内容,可以在本站寻找。

本文标签: