Using the NDK plugin

本文介绍如何在Eclipse中安装并使用NDK插件来构建和调试NDK项目。包括安装步骤、配置SDK和NDK路径、为项目启用原生支持以及进行原生应用的调试。

http://tools.android.com/recent/usingthendkplugin

Using the NDK plugin

posted Jul 2, 2012, 7:16 PM by Siva Velusamy
ADT 20 includes an NDK plugin that provides support for building and debugging NDK projects in Eclipse. This document describes how to install and use the NDK plugin.

Installation

The NDK plugin currently works with CDT 7.0.2 or CDT 8.0.2.
  1. Download Eclipse for Java.
  2. Install CDT from Eclipse update site http://download.eclipse.org/tools/cdt/releases/indigo.
  3. Install Android SDK + NDK Plugins from Eclipse update site https://dl-ssl.google.com/android/eclipse/
Using the NDK Plugin

1. First set the path to SDK and NDK:

Eclipse -> Window -> Preferences -> Android -> set path to SDK

Eclipse -> Window -> Preferences -> Android -> NDK -> set path to the NDK


2. Right click on an Android project and select Android Tools -> Add native support.
Note that you will not be able to add native support if the project already has C/C++ nature.

At this point, you will be able to build your applications using Project -> Build All.

Debugging native applications

1. Update your build config to include “NDK_DEBUG = 1”.

Right click project -> properties -> C/C++ Build:

2. Set a breakpoint in your C code.
3. Right click on your project, select Debug As -> Android Native Application

Note: There is a delay of a few seconds between when the activity is launched and when native debugging starts. If your code is already executed by that point, then you won’t see the breakpoint being hit. So either put a breakpoint in code that is called repetitively, or make sure that you call JNI code after you see that ndk-gdb has connected.

Known Issues

1. Eclipse does not automatically find the include paths to all the NDK headers on Windows. This issue will be fixed in the next update (20.0.1) when it is released.
2. Eclipse does not automatically find the include paths with CDT 8.1.0 (Juno). This issue is tracked in Bug 33788.


06-05
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... Running Gradle task 'assembleDebug'... Your project is configured with Android NDK 26.3.11579264, but the following plugin(s) depend on a different Android NDK version: - permission_handler_android requires Android NDK 27.0.12077973 - url_launcher_android requires Android NDK 27.0.12077973 Fix this issue by using the highest Android NDK version (they are backward compatible). Add the following to D:\flutterDev\dialing_assistant\android\app\build.gradle.kts: android { ndkVersion = "27.0.12077973" ... } Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! 警告: [options] 源值 8 已过时,将在未来发行版中删除 警告: [options] 目标值 8 已过时,将在未来发行版中删除 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 C:\Users\Mochi\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\permission_handler_android-10.3.6\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java:28: 错误: 找不到符号 @Nullable private io.flutter.plugin.common.PluginRegistry.Registrar pluginRegistrar; ^ 符号: 类 Registrar 位置: 接口 PluginRegistry C:\Users\Mochi\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\permission_handler_android-10.3.6\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java:47: 错误: 找不到符号 public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) { ^ 符号: 类 Registrar 位置: 接口 PluginRegistry 2 个错误 3 个警告 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':permission_handler_android:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. * Try: > Run with --info option to get more log output. > Run with --scan to get full insights. BUILD FAILED in 15s ┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────┐ │ [!] Consult the error logs above to identify any broken plugins, specifically those containing │ │ "error: cannot find symbol..." │ │ This issue is likely caused by v1 embedding removal and the plugin's continued usage of removed │ │ references to the v1 embedding. │ │ To fix this error, please upgrade your current package's dependencies to latest versions by │ │ running `flutter pub upgrade`. │ │ If that does not work, please file an issue for the problematic plugin(s) here: │ │ https://github.com/flutter/flutter/issues │ └─────────────────────────────────────────────────────────────────────────────────────────────────┘ Error: Gradle task assembleDebug failed with exit code 1
05-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值