这个有手机有一定的关系,
是路径有什么问题吧
在Android.mk中包含包就行
你创建项目的时候 直接 创建C++就支持了 我的版是android studio 3.4
老师,我的也是cpp文件不智能提示。我的是android studio2.3.2的NDK的版本是r10e的,路径都没有问题,也rebuild了一下。就是没有智能提示。这个要怎么弄啊??
不懂你的意思...像应用包这种安卓市场肯定不能上传源码,如果你是想找个代码的托管平台,可以把代码试试上传到github或者码云上。
在jni目录下创建Android.mk文件,在module/build.gradle中关联配置,如下
module/build.gradle的内容
apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.example.sun.jnidemo" minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" ndk{ abiFilters "armeabi","armeabi-v7a" } } externalNativeBuild{ ndkBuild{ path "src/main/jni/Android.mk" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }
Android.mk文件的内容
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := hello LOCAL_SRC_FILES := Hello.cpp # for logging LOCAL_LDLIBS += -llog include $(BUILD_SHARED_LIBRARY)