Doing c programming in android

Содержание
  1. 5 Best Apps to do Programming on Android Platform
  2. 5 Best Apps to do Programming on Android Platform
  3. C4droid – C/C++ compiler & IDE
  4. Features
  5. CppDroid – C/C++ IDE
  6. Features
  7. AIDE- IDE for Android Java C++
  8. Features
  9. C# To Go
  10. QPython – Python for Android
  11. You May Also Like:
  12. 15 thoughts on “5 Best Apps to do Programming on Android Platform”
  13. Subscribe For Latest Updates
  14. Создание нативных Android-приложений с использованием компилятора Intel C++ Compiler в Android Studio 1.0.1
  15. Требуемые программные инструменты
  16. Использование компилятора Intel C++ Compiler в Android Studio 1.0.1
  17. 1. Создание нового проекта Android с нативным интерфейсом:
  18. 2. Добавление нативного исходного кода: main.c
  19. 3. Добавление make-файла: Android.mk
  20. 4. Добавление make-файла: Application.mk
  21. 5. Сконфигурируйте свое приложение для выполнения ndk-build с помощью make-файлов
  22. 6. Добавьте ID «hello_textview» в виджет textview
  23. 7. Обновите «MainActivity.java», чтобы UI textview вызов нативной библиотеки:
  24. 8. Запустите виртуальную машину Android Virtual Machine «Intel-Nexus 7 x64» и выполните приложение, щёлкнув кнопку «Run».
  25. Android and iOS development with C++ in Visual Studio
  26. Install Visual Studio for Android and iOS development
  27. Create a new Android application using project templates
  28. Build an OpenGLES Application on Android and iOS
  29. Build and run the app on Android
  30. Build and run the app on iOS
  31. Visual Studio to target all mobile platforms
  32. Write cross-platform C++ code with the full power of Visual Studio IDE
  33. Debug C++ code with the world-class Visual Studio debugger
  34. Java debugging and language support for Android
  35. Editing Java code
  36. Debugging Java code
  37. Build Xamarin Android Native Applications
  38. Try out Visual Studio 2017 for mobile development with C++

5 Best Apps to do Programming on Android Platform

Are you a great programming lover? If yes, then you will surely love the apps that I have shared in this article. Because they will let you do programming anywhere on your android device. These are like having mini compilers and editors in your pocket. Below I have listed some great programming apps that will allow you to write and run code for programming languages like C, C++, Java, C# and Python.

Image Source

5 Best Apps to do Programming on Android Platform

C4droid – C/C++ compiler & IDE

C4droid is a very popular and user-friendly C/C++ IDE and compiler for Android platform. You can write and run C and C++ programs directly on your phone. It is a paid app and I personally used it. It is really great application for C/C++ programmers. Some of its features are mentioned below.

Features

  • Create your own applications on android device and run them even without internet access
  • Source code editor with syntax highlighting, tabs, code completion, code formatting, file association and undo/redo
  • Easily export and share your programs as APKs or native executables (for terminal apps)
  • No root access is required
  • Full ANSI C and ISO C99 support with TCC (Tiny C Compiler) + uClibc
  • Supports Git integration
  • Customize the GUI, choose where to place tabs and buttons, various themes are also supported.

CppDroid – C/C++ IDE

Features

  • code complete, real-time diagnostics (warnings and errors) and fixes
  • file and tutorial navigator (variables, methods, etc), static analysis
  • smart syntax highlighting, auto indentation and auto pairing (configurable)
  • compile and run C/C++ code (no root access required)
  • works offline (no internet connection required), Dropbox support

Apart from this, it also provides so many tutorials, examples and projects that will help in learning C and C++ programming.

AIDE- IDE for Android Java C++

Features

  • Interactive lessons for Android, Java and Game development
  • Edit, compile and run code with single click. No root access is required.
  • Debug Android Java apps and Java Console apps
  • Real-time error checking, Code Refactoring
  • Code completion and syntax highlighting, Dropbox integration

Using AIDE you can create basic Android apps like interest calculator, 2D games and even advanced widgets like
zooper widget.

C# To Go

If you love C# programming so much then C# To Go app will let you to do C# programming anywhere on your mobile. It is like having mini C# compiler in your pocket. C# To Go provides various features like code completion, syntax highlighting, etc. It is also a free app which can be downloaded from google play store freely.

QPython – Python for Android

QPython is a script engine that runs Python scripts and projects on android devices. It contains the Python interpreter, console, editor, and the SL4A Library for Android. It offers a great development kit which lets you easily develop Python projects and scripts on your phone.

If you know about some other good apps that allows to do programming on android platform then please mention it by commenting below. I will try to include them in this list. Also share your experience after using above apps.

You May Also Like:

15 thoughts on “5 Best Apps to do Programming on Android Platform”

Droidscript (previously Androidscript) available on the Play Store is a terrific javascript based environment. You can build apk’s as well.

Thanks for telling me about this, I will surely ad it to the list!

Just scratching the surface in programming, had a little BASIC in tech school in 1989 right after HS. Did real well in it but most was self taught bc the instructors really didn’t know much about it. Wanna learn to repair smartphones and be able to fix software issues and be able to remove ads. That’s what a lot of people want. Also very interested in learning to code. Is python a good language to use on hardware issues? Feel like I’m too old to learn C and really no interest in C. So let me know if on the right track. Thanks, Keith

Nothing called too old.. You can learn either C or Python both are so beginner friendly.. But C if you want to do deeper programming.. Sine Python considers a scripting language.. Both are programming go with the one you like 🙂

Also there is a new version for Python 3 (which is significantly different from python 2):
https://play.google.com/store/apps/details?id=org.qpython.qpy3

Thanks Stephen for suggesting changes.

It was very helpful. Thanks.

I tried cppdroid and it is magnificent offline coding app with good debugging tool
i recommend it

A strong programming platform based on the old BASIC programming language is also available for android in the name RFO BASIC (http://rfo-basic.com/). Though I haven’t tested all of its features, it appears that, we can even handle simple graphics, animations, user interfaces etc. It also permits to create apks corresponding to the user programs, so that it can be installed on android platforms.

Oh, Thank you vert much. I was looking for something so easy. Really appreciate it!

how shall I download the app. please

search them on google play store…

Well I don’t about others but as for the Cppdroid is a bad IDE I used in early December 2017 when I started c, what I noticed about it was that I will write a program and it will give error I will correct all the error and still giving error, as time goes on I noticed that whenever it happens I just need to go to the line highlighted and replace “;” with “:” run it and replace “:” with “;” this time it will run fine. Another thing is that I couldn’t view the c libraries (stdio.h, conio.h, time.h….etc.) which one may need to check the syntax of functions in case one forget them, also there are some pre defined structures e.g “struct tm” in time.h which contains constants to get operating system current time, they are easy to forget or not remember some part if not visited for a while.
You may feel you will get back to your lecture note or your tutorial video if you forget. But what if you are in a situation were by you have no access to them .
I will recommend turbo c for you guys course
It also has many useful functions for C and you view the c and c++ library, program files(source code) and others on your sdcard I have been using it for C about 2 months and trust me I’ve gone far (though I am still a beginner) and it has never disappointed me. Tapping the screen twice opens the index which contains many functions with explanation and example.

how to create a basic compiler like this in xamarin android? can anyone know how ? and what 3rd party to use

Q python 3 has some problems regarding scripts..
Not able to do complete programming in this app.
By the it is helpful to learn some basics..

Subscribe For Latest Updates

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

we respect your privacy and take protecting it seriously

Источник

Создание нативных Android-приложений с использованием компилятора Intel C++ Compiler в Android Studio 1.0.1

На момент написания этого текста текущей версией Android Studio была версия 1.0.1. Компилятор Intel C++ Compiler for Android, будучи частью Intel Integrated Native Developer Experience (Intel INDE), поддерживает Android Studio 1.0.1 в Intel INDE 2015 Update 1. Поскольку Android Studio 1.0.1 не поддерживает Android NDK, в этой статье описаны шаги для создания нативного Android-приложения с использованием Android NDK r10d и компилятора Intel C++ Compiler for Android. Поехали!

Android Studio в качестве системы сборки использует Gradle. На момент написания статьи Gradle в процессе сборки вызывала систему NDK. В Android NDK r10 и более поздней версии после инсталляции Intel INDE компилятор Intel C++ Compiler for Android (ICC) не является более используемым по умолчанию компилятором в системе сборки NDK.

Представленные ниже шаги дают общее описание подготовки, сборки и выполнения нативного приложения в Android Studio 1.0.1.

Если вы используете Android Studio 0.8.6, почитайте статью «Сборка нативных Android-приложений с использованием компилятора Intel C++ Compiler в Android Studio», где рассказывается о применении Intel C++ Compiler.

Требуемые программные инструменты

Успешная инсталляция INDE 2015 Update 1 с Android Studio Integration гарантирует, что вы располагаете всем необходимым программным обеспечением. Детальные требования к программному обеспечению и системе описаны в документе Intel C++ Compiler Release Notes for Intel Integrated Native Developer Experience 2015.

Приведенные в данной статье инструкции предполагают использование следующего ПО для архитектуры IA-32 и Intel-64:

  • Oracle JDK 7 (нативный Intel-64 JDK для систем Windows x64)
  • Android SDK 20 или старше
  • NDK r10d (предполагается инсталляция в [ndk-dir] )
  • Android Studio 1.0.1

Убедитесь, что в переменную среды PATH добавлены следующие директории Android NDK (если они отсутствуют, добавьте):

Использование компилятора Intel C++ Compiler в Android Studio 1.0.1

После инсталляции Intel C++ Compiler 15.0 for Android в папку «[ndk-dir]\toolchains» (директория по умолчанию – «C:\Intel\INDE\IDEintegration\android-ndk-r10d\toolchains») устанавливаются следующие элементы:

  • x86-icc
  • x86-icc15.0.X.YYY
  • x86_64-icc (если NDK поддерживает 64-разрядные цели)
  • x86_64-icc15.0.X.YYY (если NDK поддерживает 64-разрядные цели)

Для NDK до r9d: после инсталляции нативным компилятором C/C++ будет Intel C++ Compiler. Дополнительных шагов для использования Intel C++ Compiler с Android Studio не требуется. Ели вы хотите для построения нативного кода использовать GNU gc, следуйте инструкциям в «Замена компилятора по умолчанию с Intel C++ Compiler на GCC для целевых приложений x86».

Для NDK r10 — r10d: компилятор Intel C++ после инсталляции не является компилятором по умолчанию. Чтобы использовать Intel C++ Compiler из Android Studio, следуйте шагам 3, 4, 5 ниже.

Если у вас установлено несколько Android NDK, следуйте инструкциям в статье «Интеграция Intel C++ Compiler for Android с несколькими Android NDK».

Теперь создадим новый проект Android для Intel-64 с нативным вызовом функции, продемонстрировав тем самым использование компилятора Intel C++ Compiler:

1. Создание нового проекта Android с нативным интерфейсом:

1. Откройте Android Studio, создайте новый Android-проект «nativeDemo» с параметрами по умолчанию, например:

2. Откройте «app\src\main\java\MainActivity.java» и добавьте в конец класса «MainActivity» нативную функцию как показано ниже:

Должно получиться примерно так:

3. Чтобы создать проект «nativeDemo», выберите: «Build > Make Project», после чего можно будет использовать «javah».
4. В «View > Tools Windows > Terminal» откройте терминальное окно и выполните указанные ниже шаги для запуска «javah» и создания заголовка jni:
a) В терминальном окне перейдите в подпапку «src\main»:

b) Чтобы создать «com_example_nativedemo_app_MainActivit.h» в папке src\main\jni, выполните следующую команду «javah» cmd:

5. В окне Project измените вид на Project, щелкните правой кнопкой мыши на папке «src» и выберите «Synchronize ‘src». Теперь в папке «src\main\jni» можно видеть файл заголовка «com_example_mydemo_nativedemo_MainActivity.h».

2. Добавление нативного исходного кода: main.c

1. Создайте «main.c»: выделите файл «com_example_mydemo_nativedemo_MainActivity.h», используйте волшебные клавиши copy/paste для создания нового «main.c» со следующим кодом:

2. Сохраните изменения
3. Теперь в папке «jni» у вас два файла: com_example_mydemo_nativedemo_MainActivity.h и main.c

3. Добавление make-файла: Android.mk

1. Щелкните правой кнопкой на папке «jni», выберите «New > File»
2. Наберите «Android.mk» и щёлкните на «OK»
3. Добавьте в этот файл следующие строки (обратите внимание, что строка LOCAL_SRC_FILES должна содержать исходные файлы, которые находятся в папке «jni»):

4. Добавление make-файла: Application.mk

1. Щелкните правой кнопкой на папке «jni», выберите «New > File»
2. Наберите «Application.mk» и щёлкните на «OK»
3. Добавьте в этот файл следующие строки:

4. [Опционально] Для изменения параметров компилятора используйте следующее:

5. Сконфигурируйте свое приложение для выполнения ndk-build с помощью make-файлов

1. Откройте файл «app\build.gradle»
2. Добавьте в начало файла следующий импорт:

3. И эти строки после секции «defaultConfig»:

4. А следующие строки – в конец файла:

5. Сохраните изменения
6. Теперь создадим проект: выберите [Build > Make Project]. Вы увидите все выходные папки и файлы «libmain.so» в папках «main\libs» и «main\obj\local».

6. Добавьте ID «hello_textview» в виджет textview

Откройте «res\layout\activity_main.xml» и измените виджет «textview» как показано ниже:

7. Обновите «MainActivity.java», чтобы UI textview вызов нативной библиотеки:

Для импорта виджета TextView и сохранения изменений нажмите ALT+Enter.

8. Запустите виртуальную машину Android Virtual Machine «Intel-Nexus 7 x64» и выполните приложение, щёлкнув кнопку «Run».

Это означает, что был использован компилятор Intel C++ Compiler for Android.

Источник

Android and iOS development with C++ in Visual Studio

April 18th, 2017

When it comes to building mobile applications, many developers write most or a part of the apps in C++. Why? Those who are building computationally intensive apps such as games and physics simulations choose C++ for its unparalleled performance, and the others choose C++ for its cross-platform nature and the ability to leverage existing C/C++ libraries in their mobile applications. Whether you’re targeting Universal Windows Platform (UWP), Android, or iOS, Visual Studio enables building cross-platform C++ mobile applications with full editing and debugging capabilities all in one single IDE.

In this blog post, we will focus on how to build Android and iOS apps with C++ in Visual Studio. First we will talk a look at how to acquire the tools for Android and iOS development, then we will create a few C++ mobile apps using the built-in templates. Next we will use the Visual Studio IDE to write C++ and Java code, then we will use the world-class Visual Studio debugger to catch issues in C++ and Java code. Finally, we will talk about how the C++ mobile solution can be used in conjunction with Xamarin.

Install Visual Studio for Android and iOS development

First, download Visual Studio 2017 and launch the Visual Studio installer.

To build Android or iOS applications, choose the “Mobile development with C++” workload under the “Mobile & Gaming” category.

Android development: By default, this workload includes the core Visual Studio editor, the C++ debugger, GCC and Clang compilers, Android SDKs and NDKs, Android build tools, Java SDK, and C++ Android development tools. You could choose to install the Google Android Emulator in the Optional Component list if you don’t have an Android device for testing. This should give you everything you need to start building Android applications.

iOS development: if you’re also targeting iOS, check “C++ iOS development tools” in the Optional Component list and you would be good to go.

Create a new Android application using project templates

If you plan to start with targeting Android first and worry about other platforms later, the VS built-in Android project templates including Native-Activity Application, Static Library, Dynamic Shared Library, could be a great starting point. If you’d rather start with a cross-platform solution to target multiple mobile platforms, jump to the next section Build an OpenGLES Application on Android and iOS where we’ll talk about building an app that targets both platforms with shared C++ code.

You can find the Android templates under Visual C++ -> Cross Platform -> Android node.

Here we’re going to create a new Native Activity Application (Android), which is popular for creating games and graphical-intensive apps. Once the project is created, in the Solution Platforms dropdown, choose the right architecture that matches the Android emulator or device that you’re using, and then press F5 to run the app.

By default, Visual Studio uses the Clang toolchain to compile for Android. The app should build and run successfully, and you should see the app changing colors in the background. This article Create an Android Native Activity App discusses the Native Activity project in more details.

Build an OpenGLES Application on Android and iOS

The OpenGL ES Application project template under Visual C++->Cross Platform node is a good starting point for a mobile app targeting both Android and iOS. OpenGL ES (OpenGL for Embedded Systems or GLES) is a 2D and 3D graphics API that is supported on many mobile devices. This template creates a simple iOS app and an Android Native Activity app which has C++ code in common that uses OpenGL ES to display the same animated rotating cube on each platform.

The created OpenGL ES Application solution includes three library projects in the Libraries folder, one for each platform and the other one for shared C++ code, and two application projects for Android and iOS respectively.

Now let’s run this app on both Android and iOS.

Build and run the app on Android

The solution created by the template sets the Android app as the default project. Just like run the Android Native Activity app we discussed earlier, in the Solution Platforms dropdown, select the right architecture that matches the Android emulator or device that you’re using, and then press F5 to run the app. The OpenGL ES app should build and run successfully and you will see a colored 3D spinning cube.

Build and run the app on iOS

The iOS project created in the solution can be edited in Visual Studio, but because of licensing restrictions, it must be built and deployed from a Mac. Visual Studio communicates with a remote agent running on the Mac to transfer project files and execute build, deployment, and debugging commands. You can setup your Mac by following instructions Install And Configure Tools to Build using iOS.

Once the remote agent is running on the Mac and Visual Studio is paired to it, we can build and run the iOS app. In the Solution Platforms dropdown in Visual Studio, choose the right architecture for the iOS simulator (x86) or the iOS device. In Solution Explorer, open the context menu for the OpenGLESApp1.iOS.Application project and choose Build. Then choose iOS Simulator on the toolbar to run the app in the iOS Simulator on your Mac. You should see the same colored 3D spinning cube in the iOS Simulator.

This article Build an OpenGL ES Application on Android and iOS includes more details about the OpenGLES project.

Visual Studio to target all mobile platforms

If you’re building an app to target multiple mobile platforms (Android, iOS, UWP) and wish to share the common code in C++, you can achieve this by having one single Visual Studio solution and leverage the same code-authoring and debugging experience all in the same IDE. With Visual Studio, you can easily share and re-use your existing C++ libraries through the shared project component to target multiple platforms. The following screenshot shows a single solution with 4 projects, one for each mobile platform and one shared project for common C++ code.

Write cross-platform C++ code with the full power of Visual Studio IDE

With Visual Studio, you can write cross-platform C++ code using the same powerful IntelliSense and code navigation features, making code writing much more efficient. These editing capabilities not only light up in the common code, but are context-aware of the target platform when you write platform-specific code.

Member list and Quick Info, as shown in the following screenshot, are just two examples of the IntelliSense features Visual Studio offers. Member list shows you a list of valid members from a type or namespace. Typing in “->” following an object instance in the C++ code will display a list of members, and you can insert the selected member into your code by pressing TAB, or by typing a space or a period. Quick Info displays the complete declaration for any identifier in your code. IntelliSense is implemented based on the Clang toolchain when targeting the Android platform. In the following screenshot, Visual Studio is showing a list of the available Android-specific functions when the Android Native Activity project is active.

Auto-complete, squiggles, reference highlighting, syntax colorization, code snippets are some of the other useful productivity features to be of great assistance in code writing and editing.

Navigating in large codebases and jumping between multiple code files can be a tiring task. Visual Studio offers many great code navigation features, including Go To Definition, Go To Line/Symbols/Members/Types, Find All References, View Call Hierarchy, Object Browser, and many more, to boost your productivity.

The Peek Definition feature, as shown in the following screenshot, brings the definition to the current code file, allows viewing and editing code without switching away from the code that you’re writing. You can find Peek Definition by opening the context menu on right click or shortcut Alt+F12 for a method that you want to explore. In the example in the screenshot, Visual Studio brings in the definition of __android_log_print method that is defined in the Android SDK log.h file as an embedded window into the current cpp file, making reading and writing Android code more efficiently.

Debug C++ code with the world-class Visual Studio debugger

Troubleshooting issues in the code can be time-consuming. Use the Visual Studio debugger to help find and fix issues faster. Set breakpoints in your Android C++ code and press F5 to launch the debugger. When the breakpoint is hit, you can watch the value of variables and complex expressions in the Autos and Watch windows as well as in the data tips on mouse hover, view the call stack in the Call Stack window, and step in and step out of the functions easily. In the example in the screenshot below, the Autos window is showing value changed in the Android sensorManager and accelerometerSensor types.

The Android debugging experience in Visual Studio also supports for debugging pre-built Android application via other IDE(s), other basic debugger capabilities (tracepoints, conditional breakpoints) and advanced features such as debugger visualizations (Natvis Support) and attaching to a running Android application as well.

You can find more information about the C++ debugger in this blog post C++ Debugging and Diagnostics.

Java debugging and language support for Android

Whether you’re writing Java or C++ code in your Android apps, Visual Studio has it covered. Visual Studio includes a Java Debugger that enables debugging Java source files in your Android projects, and with the Visual Studio Java Language Service for Android extension, you can also take advantage of the IntelliSense and browsing capabilities for Java files in the Visual Studio IDE.

Editing Java code

First, install the Visual Studio Java Language Service for Android extension. It provides colorization (both syntactic and semantic), error and warning squiggles as well as code outlining and semantic highlighting in your Java files. You will also get IntelliSense assistance, such as Member List, Parameter Help, Quick Info, making writing Java code more efficient. In the following screenshot, Visual Studio provides a member list for the android.util.Log class.

Another handy feature for larger codebases or for navigating 3rd party libraries for which you have the source code available is Go to definition (F12) which will take you to the symbol definition location if available.

Debugging Java code

To turn on Java debugging for your Android projects in your next debugging session, in the Debug Target toolbar, change Debug Type dropdown to “Java Only” as shown in the following screenshot.

Now you can set line breakpoints, including conditions or hit counts for the breakpoints, anywhere in the Java code. When a breakpoint is hit, you can view variables in the Locals and Autos window, see call stack in the Call Stack window, and check log output in the Logcat window.

Build Xamarin Android Native Applications

Xamarin is a popular cross-platform solution for creating rich native apps using C# across mobile platforms while maximizing code reuse. With Xamarin, you could create apps with native user interfaces and get native performance on each mobile platform. If you want to leverage Xamarin for writing user interfaces in C# while re-using your existing C/C++ libraries, Visual Studio fully supports building and debugging Xamarin Android apps that reference C++ code. This blog post Developing Xamarin Android Native Applications describes this scenario in more details.

Referencing C++ libraries in Xamarin iOS apps can be achieved by following this blog post Calling C/C++ libraries from Xamarin code.

Try out Visual Studio 2017 for mobile development with C++

Download Visual Studio 2017, try it out and share your feedback. For problems, let us know via the Report a Problem option in the upper right corner of the VS title bar. Track your feedback on the developer community portal. For suggestions, let us know through UserVoice.

Источник

Читайте также:  Как сохранить данные андроид для переноса
Оцените статью