[Q] [DEV][Gradle] How to make a modular Application ? - Android Software Development

Hi guys,
I'm currently working on an app for a company that asked me to make it modular.
Actually the app contains different features and the company would like to be able to compile the differents flavors of the App via Gradle.
If I understood correctly the current flavor solution offered in Android Studio doesn't fit my needs as if I have like 5 differents modules I'd have to make a flavor for : feature 1, feature 1 + 2, feature 1 + 2 + 3, feature 1 + 2 + 3 + 4, feature 1 + 2 + 3 + 4 + 5, feature 2, feature 2 + 3, ...... and so on.
So how can I say to gradle I just want to compile this part of my code ?
And how can I manage my code in a clean way for my app to understand which modules are enabled or not ?
Thanks a lot for your answers !

Not sure I'm understanding the problem. Create the flavors and in each of the src/<flavor>/ directories you can specify a build.gradle file and in that gradle file you can add dependencies for other modules. So this modular code would exist in <project root>/libprojects and the separate flavors would then conditionally include that code as a dependency. Make sense?
.
libprojects/module1
libprojects/module2
libprojects/module3
src/flavor1/build.gradle
src/flavor2/build.gradle
/src/flavor3/build.gradle
Each of those build.gradle files in the separate flavors could include dependencies for modules that it needs. Remember, code in a flavor takes precedence over code in src/main/java. So use that to your advantage to creating modular code.

Thanks a lot for your answer
It kinda give me an answer for the concept of isolating code on libraries. But the code isn't the biggest issue for me. Is it possible to put the resources (drawable and raw) in the libs so that I can grab them only on the required flavor of my app ? And do this via gradle dependency as I would have too much flavors otherwise.
Thanks again

joplayer said:
Thanks a lot for your answer
It kinda give me an answer for the concept of isolating code on libraries. But the code isn't the biggest issue for me. Is it possible to put the resources (drawable and raw) in the libs so that I can grab them only on the required flavor of my app ? And do this via gradle dependency as I would have too much flavors otherwise.
Thanks again
Click to expand...
Click to collapse
FYI, make sure you tap "reply" in the future so a person's post is "quoted" otherwise that person, me, doesn't get notified you responded from XDA. I just happened to click back on this post. Didn't receive a notification.
When you say libs do you mean "libprojects" folder or do you mean libs as in creating a jar file with those resources? Don't forget you can copy the dependencies from another flavor if you need to at compile time. Not sure if that would help in your scenario.

shafty023 said:
FYI, make sure you tap "reply" in the future so a person's post is "quoted" otherwise that person, me, doesn't get notified you responded from XDA. I just happened to click back on this post. Didn't receive a notification.
When you say libs do you mean "libprojects" folder or do you mean libs as in creating a jar file with those resources? Don't forget you can copy the dependencies from another flavor if you need to at compile time. Not sure if that would help in your scenario.
Click to expand...
Click to collapse
Sorry, bad old reflex
Actually that is my problem. How am I supposed to isolate my features ? Should I make an Android library ? Should I brutally use gradle to isolate some files ?
Thanks again

joplayer said:
Sorry, bad old reflex
Actually that is my problem. How am I supposed to isolate my features ? Should I make an Android library ? Should I brutally use gradle to isolate some files ?
Thanks again
Click to expand...
Click to collapse
It really depends on what you mean by isolate features. If you mean paid vs free app then you should undoubtedly isolate those features with a gradle variable that is set at compile time and read from at runtime via the BuildConfig class.
Code:
if (BuildConfig.IS_PRO) {
... some code
}
It's more of a mess to exclude code then to just make a single code source where you conditionally include/exclude based on compile time variables.

shafty023 said:
It really depends on what you mean by isolate features. If you mean paid vs free app then you should undoubtedly isolate those features with a gradle variable that is set at compile time and read from at runtime via the BuildConfig class.
Code:
if (BuildConfig.IS_PRO) {
... some code
}
It's more of a mess to exclude code then to just make a single code source where you conditionally include/exclude based on compile time variables.
Click to expand...
Click to collapse
Thanks a lot I think this kind of syntax might help me.
To make things clear the product will be compilable for different end products. One might want geolocalization, another not. As features end up taking space in the APK I need to exclude them from compilation. And finally this app must be compilable out of Android Studio so Gradle is my only savior ! And I'm far from beeing a Gradle expert so thanks for your answer I'll look at it

Related

source code to hook SystemAPISets implemented in nk.exe

mamaich said:
Occasionally I've found this page - http://blogs.msdn.com/sloh/archive/2005/05/27/422605.aspx
It has an interesting code at the bottom. I've already made a program that can hook system calls, I'll try to hook EnterCriticalSection and WaitForMultipleObjects and force them to use that code. Maybe this would reduce the occasional lockdowns.
Click to expand...
Click to collapse
I've made such a program. It gave no noticeable improvements for me, but I've attached it to this post with source code.
Source code would be interesting to people, who need to hook kernel functions that are implemented in nk.exe.
The function uses LoadKernelLibrary to load DLL, DLL relocates SystemAPISets table to writeable memory and hooks needed functions.
Code has no comments and looks ugly, but is short and should be easy to understand.
mamaich: thanks so much for this. I need all the hooking code I can get my hands on right now.
Will look at this ASAP. In your debt
V
Thanks...I've just started programming in EVC++ 4, so it might be useful.
Project is compiled with VS2005, it can be ported to eVC4. And it is designed for WM5, but should work also with older OSes, maybe minor modifications in internal OS structures may be necessary.

[DEV] AndroidLib - .NET Android Device Communication and Management Library 01.20.13

Description:
AndroidLib is a .NET assembly written in C# (C-Sharp) that easily handles communication between a connected Android device and your program. Currently, there is a large amount of automated controls, eliminating thousands of lines of code the programmer has to write themselves. The class AndroidController is a semi-wrapper of the ADB (Android Debug Bridge) binary. The other class you will be working with the most is the Device class. This class contains useful information about the device (for example: software/hardware info, memory info, battery stats, mount points for partitions, root status, busybox information, and much more), as well as exposes many instance methods to control your phone such as Rebooting, Mounting Filesystems, Push/Pull/Install Files, and much more to come. AndroidLib contains all of the Android binaries necessary to work properly. AndroidLib also assumes that the phone's USB drivers are already installed correctly on the target machine, or that your program will take care of it on it's own.
This is perfect for any developer who would like to create, for example, an auto-rooter or any other application that needs to connect with Android devices through a .NET application. AndroidLib provides all the methods needed to communicate with the Android device. This will cut back on the code you have to come up with and write yourself by a HUGE amount!
What it does:
Provides easy-to-use code for communicating with Android devices in .NET
Provides easy access to information about the connected Android devices
Has a large list (and growing...!) of methods that control connected Android devices
Please credit the work here by me in your own projects; not only to give thanks to me and the many hours I am putting in to this project, but so others know where to find it if they need to!
Usage:
Add a reference to AndroidLib.dll in your .NET project and begin using this great API. Please refer to the "Getting Started.txt" guide and full documentation included in the zip.
Requirements:
.NET 3.5 or Higher
Changelog (Only most recent version displayed, full Changelog in download)
Version 1.5.1.0 | 01.21.13
Fixed Device.InstallApk() bug
Download Latest Release
GitHub
Online Documentation
Sample Solutions Using AndroidLib:
C# (C Sharp)
Visual Basic (VB)
AndroidLib Featured Projects by XDA Users:
RegawMOD Evo 4G LTE Rooter - XDA
RegawMOD CDMA Hero Rooter - XDA
RegawMOD Rebooter - XDA
Droid Manager by DeepUnknown - XDA - Google
Android SMS - XDA - Home Page
Quick ADB Pusher by Goatshocker - XDA
reserved just in case
It's very useful, thank you very much, im planning to code a Filemanager like qtadb, because qtadb is sucking too often
In the process of completely redesigning the library (due to coding stupidity), basically from the base class up. I should have a beta1 out by this weekend for testing. All that are interested in beta testing this library for their Android .NET projects, post here and I'll add you to the list of testers!
It would be great!
Can you add something like adb forward? So we can connect to an android service without using ADB, that as we all know sucks!
Mrc527 said:
It would be great!
Can you add something like adb forward? So we can connect to an android service without using ADB, that as we all know sucks!
Click to expand...
Click to collapse
Yeah, I'll throw in a method to create a port forward. What I have now uses the bridge, which is included in the assembly, but handles all of it silently and very well. I should have a build out soon (most likely this weekend). As long as you don't dispose the AndroidController object, that port forward will be good, so you can use your own Socket code
regaw_leinad said:
Yeah, I'll throw in a method to create a port forward. What I have now uses the bridge, which is included in the assembly, but handles all of it silently and very well. I should have a build out soon (most likely this weekend). As long as you don't dispose the AndroidController object, that port forward will be good, so you can use your own Socket code
Click to expand...
Click to collapse
Great work! really, great idea!
You can change the .NET to 3.5? I too code in .NET, and I try to keep the .NEt version as low as possible!
SimranSingh said:
You can change the .NET to 3.5? I too code in .NET, and I try to keep the .NEt version as low as possible!
Click to expand...
Click to collapse
Yeah, I actually did that a few days ago, forgot to update the OP.
Where is it possible to download?
Mrc527 said:
Where is it possible to download?
Click to expand...
Click to collapse
I'm just writing the documentation for this. I'm pretty sure I'll have it done today.
Yeah! Just a joke. When finished I'm sure will be a success!
Inviato dal mio Galaxy Nexus usando Tapatalk
Making some last minute changes to the Device class, then I'm going to finish the documentation and release it. Just keeping you updated.
Ok everyone, the new documentation is up (Online) (Offline). For the beginning of this product, I would like developers to pm me, or reply here in the thread if they would like to try the library out for their project, and I'll send it to them. It's still under development, and there will be updates coming out regularly. Shoot me a pm or post here and I'll send you a link right away.
regaw_leinad said:
Ok everyone, the new documentation is up (Online) (Offline). For the beginning of this product, I would like developers to pm me, or reply here in the thread if they would like to try the library out for their project, and I'll send it to them. It's still under development, and there will be updates coming out regularly. Shoot me a pm or post here and I'll send you a link right away.
Click to expand...
Click to collapse
Meeeeeeeeeeeeeeeeeeeeee!!
Hi,
I'm C# developer and i would like to try your lib, can you send it please?
Thanks in advance, and great work.
Hey guys, check the first post to download the library. It is in a zip which includes the dll, "Getting Started.txt" and the documentation. Please read the getting started guide before diving into it! And please give me feedback on it. That would be much appreciated in order for me to deliver a better product.
Dan
Great work!
It works without any problem to me!
Next update will have these features internally implemented:
Package Manager (inside the phone's shell)
Ability to install/uninstall apks
Ability to freeze/unfreeze apks
Ability to backup/restore apks
A class that will handle signing of update zips
More internal information about connected device (cpu, environment, etc)
Possible wrapper of AAPT
That seems like a good amount for the next update. Please post anything you wish to share about the library after using it for these few days.

[LIBRARIES][SOURCE] WP8 Native Access project

This thread is for announcements and discussion around the WP8NativeAccess project (https://wp8nativeaccess.codeplex.com/). The purpose of this project is to provide general-purpose libraries, usable from C++ or .NET, which enable access to the underlying functions of the OS. In some cases, this will mean simple wrappers around native APIs; in other cases, these will be more advanced operations which simplify using the low-level APIs.
Some of the functions that the Native Access project exposes are already available via the official APIs. Other functions, however, are not. While I have no objection to these libraries being used in Store apps (license permitting), it is unlikely that Microsoft will permit the ones which use unofficial APIs.
Note that this library does not provide any method for elevation of privileges. Consequently, the use of these APIs will be constrained by the sandbox in which all third-party WP8 apps run, as defined by the capabilities in the app manifest. In practical terms, this means that most of the system will be either inaccessible or read-only. Even so, it has already proven useful to myself. When combined with interop-unlock and Capability-unlock hacks (making it possible for apps to obtain higher privileges), these APIs become much more useful. In fact, the EnableAllCapabilities utility uses the Registry library. Similarly, if you have the ability to use restricted Capabilities in an app you are developing, you may find these libraries useful.
The libraries are as follows:
FileSystem version 0.4.0: Implements functionality to read, write, and get information about files and directories, plus supports creating symbolic links and enumerating file system volumes. This version contains a breaking change from 0.3.x: the NativeFileSystem functions are now static and the constructor is removed. This library may be built with or without the macro USE_NON_PUBLIC_APIS; by default it now includes this macro and require kernelbase.lib to build. If this macro is not defined, it builds using the public APIs without requiring any special libraries.
Registry version 0.2.9: Implements functionality to read and write registry values, and to create and delete registry keys and values. Many, though not yet all, registry value types are fully supported. This library consists entirely of non-public (for WP8) APIs and requires the KERNELBASE.LIB and ADVAPI32LEGACY.LIB export libraries for Windows Phone 8 in order to build (the DLLs are in C:\Windows\System32 on the phone; you can use Dll2Lib.exe to extract the .LIB files).
Processes version 0.1.0: Implements basic functionality to get information about your process, and to create or kill a child process. Very early version.
They are licensed under the Microsoft Permissive License.
The FileSystem and Registry libraries are currently being used by my WP8 File Access Webserver project (http://forum.xda-developers.com/showthread.php?t=2355034).
My EnableAllSideloading app uses the Registry library (http://forum.xda-developers.com/showthread.php?t=2435697).
@hjc4869 has a basic FileExplorer app which uses the FileSystem library (http://forum.xda-developers.com/showthread.php?t=2497788).
You may need to use 7-Zip or another extraction program better than the built-in Windows Zip extractor to open the archive.
Reserved for OP...
Updated. This will be the main place on XDA for releases of the NativeAccess libraries going forward. Additionally, please report problems or make feature requests here.
I think there should be some way to list all the volumes...
Perhaps windows runtime has provided an async win32 file API wrapper which has the same ability as win32 ones ,so I think undocumented file API and registry ,process and etc are more important.
The latest version of the NativeFileSystem library can give you the mount points (as strings) for all volumes (C:\, D:\, etc.)... I implemented that a few days ago; it should be in this update. Sorry for not highlighting that more clearly (typo in the OP fixed now).
Can't open "NativeAccessLibraries_040_029_010.zip"
Edit Ok with 7-zip
How odd, you're right. I didn't do anything terribly fancy while building that ZIP, so I really don't know what's up with that.
I have added the NativeFileSystem library to my PDF to Office app...
Thanks again for all your work !
@GoodDayToDie: Congratulations, good work! Unfortunately I can't import the registry library, it says it's not a valid DLL. I have Visual Studio 2013 Pro. Does it work for WP8? Please help me solving the problem. Thanks!
Sent from my Windows Phone using Tapatalk
myst02 said:
@GoodDayToDie: Congratulations, good work! Unfortunately I can't import the registry library, it says it's not a valid DLL. I have Visual Studio 2013 Pro. Does it work for WP8? Please help me solving the problem. Thanks!
Sent from my Windows Phone using Tapatalk
Click to expand...
Click to collapse
You need to reference .winmd file, not the .dll file.
Thanks! Can we also modify hex registry values with it?
Sent from my Windows Phone using Tapatalk
If you have the required permissions, yes. There's read/write functions for REG_BINARY, and also a simple wrapper around RegSetValue that will work for any type.
However, the library doesn't actually give you any privileges your app didn't already have. Without special Capabilities (which usually require hacks to enable), you won't have write access anywhere in the registry at all...
GoodDayToDie said:
If you have the required permissions, yes. There's read/write functions for REG_BINARY, and also a simple wrapper around RegSetValue that will work for any type.
However, the library doesn't actually give you any privileges your app didn't already have. Without special Capabilities (which usually require hacks to enable), you won't have write access anywhere in the registry at all...
Click to expand...
Click to collapse
OK, thanks, but another question: I referenced .winmd file, but it gives me error, the component was not found. Any idea how to fix it?
Do you have the DLL and the WINMD in the same location? Are you creating a WP8.0 app (I don't know if apps targeting 8.1 specifically will work)? Are you building for ARM?
Yeah, I have. Library now working, but it doesn't recognize the commands, I mean if I write NativeRegistry.ReadDWORD command not found :/ Can you help me?
Sent from my RM-915_lta_lta_330 using Tapatalk
You're going to need to be way more specific.
How far did you get, i.e. can you compile the app? Install the app? Launch the app? Does it crash immediately or does it actually load? Etc.
What, *exactly*, breaks? Does it break when you try to reference the NativeRegistry library, or only when you try to actually use ReadDWORD function, or some time later? If you are able to call readDWORD, what is the return value? If it fails, what is the error code?
Are you getting an exception, or does it just not work? If it's an exception, give me as much detail about it as you can (the type, the message, the code where it happened, etc. if possible).
myst02 said:
Yeah, I have. Library now working, but it doesn't recognize the commands, I mean if I write NativeRegistry.ReadDWORD command not found :/ Can you help me?
Sent from my RM-915_lta_lta_330 using Tapatalk
Click to expand...
Click to collapse
Try to rebuild the solution.
GoodDayToDie said:
You're going to need to be way more specific.
How far did you get, i.e. can you compile the app? Install the app? Launch the app? Does it crash immediately or does it actually load? Etc.
What, *exactly*, breaks? Does it break when you try to reference the NativeRegistry library, or only when you try to actually use ReadDWORD function, or some time later? If you are able to call readDWORD, what is the return value? If it fails, what is the error code?
Are you getting an exception, or does it just not work? If it's an exception, give me as much detail about it as you can (the type, the message, the code where it happened, etc. if possible).
Click to expand...
Click to collapse
Hi, I can't even build it, it doesn't recognize the command and makes a red line under it. I can reference the library, but not use any commands like ReadDWORD, WriteDWORD and so on. Screenshot is attached, this is happening if I load your EnableAllSideloading App, for example. With self-created projects I have the same problem. My system is Win 8.1 Pro x64 and I'm using Visual Studio 2013 Professional. Can you help me? Thanks!
You have added
Registry.winmd in reference library
and
Using Registry;
in your source code
Source code for EnableAllSideloading already has the requisite using directives...
When you look in the project's References, is the Registry library referenced correctly? By default it'll try to use a relative path that I use on my PC, but probably not the same path you use. You may need to manually adjust the reference, or delete it and re-create it.
Alternatively, what auto-fix options does Visual Studio give you when you click on those red lines?

XAP/DLL/EXE Hacking Tool (disassembler, decompiler, compiler)

.NET decompiler with support for XAP applications. Allows hackers developers to decompile assemblies and resources in a code editor, make changes and compile the code back to the assembly.
Click to expand...
Click to collapse
View on GitHub
Features:
Decompile .NET assemblies to C# and allow editing/compiling the high-level code back to CIL
Edit CIL instructions in method bodies
Modify assembly structure
Edit and extract assembly resources
Edit the contents of a XAP by adding, removing or swapping files, or using internal editors for certain resource types.
Integrated editors for text, hex, manifest, resource, XML and XAML.
XAP package manager (compatible with Windows Phone and Silverlight applications) allowing to view and extract XAP contents.
Does laundry, has mastered Italian cuisine, cleans and makes mind-blowjobs when asked kindly and treated right.
Click to expand...
Click to collapse
Some of your skills that could be useful may be:
Blogging: You can write down the results of your testing, your ideas and stuff about .NET Rain the way you see it.
UI/UX design: You don't have to bother with WPF implementation. Photoshop designs are good enough.
C#/WPF programming: You can contribute to the code quality and all user-related features of the application.
C# Reflection mastery: The "core" is in a very alpha state and is full of bugs. The are many planned new features, too.
Donations: They will be wisely spent.
Crowd-funding experience: You can help with raising money to pay for community-hired professionals to write code that will later remain open-source.
Virgin goat blood: For recreational uses.
Click to expand...
Click to collapse
Not going to lie, I laughed at that last part in the description. Very good work. Thanks for sharing!
I laughed at the git hub title for DLL editing : DLL Deep Throat XD
lol WUT!
Edit : Screen****s ? XD
jepp nice way to word some things , but please let us not use the kind of words here
and yes real good jop
I live to serve the forum rules, so fear not. GitHub is quite liberal, on the other hand
Let me know how do you like it because as of a while I'm experimenting with great new substances.
The effects of which include, but are not limited to, reviving this old project into The Tool for Windows 10.
So I'd love some (a lot of) "pre-"feedback. Try it out. Open issues on GitHub. Help me make it awesome.
Cheers

[Tutorial] Accessing to the Java 8 language features with Android N

Hello,
I create that thread to share with you a tutorial showing you how to access the Java 8 language features with Android N. You can find the tutorial here on my blog : http://www.ssaurel.com/blog/accessing-to-the-java-8-language-features-with-android-n/ . There are also others great tutorials for Android development.
If you prefer to read the tutorial here, this is the complete content :
Accessing to the Java 8 language features with Android N
Google has unveiled developer preview of Android N last month with a new exciting developer program. Official release is planned for Q3 2016. Amongst the new features of Android N, the support of several Java 8 language features is a great addition for developers.
Supported features include :
Lambda expressions
Default and static interface methods
Repeatable annotations
Method References
Additionally, some new APIs introduced with Java 8 are available like reflection and language-related APIs and Utility APIs (java.util.function and java.util.stream).
Set up your development environment
To support Android N new features, you need to set up correctly your development environment. You need to get last version of Android N developer preview and to download Android Studio 2.1. You can make these installations via the Android SDK Manager on your computer. To get more details about the installation process, don’t hesitate to read the official documentation from Android Team : http://developer.android.com/preview/setup-sdk.html
Enable support for Java 8
In order to use the new Java 8 language features, you need to use the new Jack toolchain. Jack, for Java Android Compiler Kit, replaces javac compiler. It compiles Java language source code into Android-readable dex bytecode with its own .jack library format. Furthermore, it provides other great toolchain features inside a single tool like repackaging, shrinking, obfuscation and multidex. Before Jack, you needed to use ProGuard to achieve these tasks for example.
To enable support for Java 8 in your Android project, you need to configure your build.gradle file like that :
Code:
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Enjoy your first Lambda Expression on Android
Now, you can enjoy your first Lambda expression on Android. Basically, a Lambda expression is a block of code that can be passed around to be executed later. In fact, it is very similar to anonymous classes. However, Lambda expressions are succinct with less verbose code. Let’s use a Lambda to set a click listener on a Button :
Code:
button.setOnClickListener(view -> Log.d(TAG, "Button Clicked."));
You can make the same with an item click listener on a ListView :
Code:
listView.setOnItemClickListener((parent, view, position, id) -> {
// …
}
It works great with a Runnable interface too :
Code:
Runnable runnable = () -> Log.d(TAG, "Log from a Runnable with a Lambda");
newThread(runnable).start();
Clearly, you can see the code is shorter and more readable with Lambdas expressions. It will be great for the productivity of Android developers.
Create your first Functional Interface on Android
To create our first Functional on Android, let’s take classic example of a Calculator with an addition feature :
Code:
@FunctionalInterface
public interface Calculator {
int calculate(int a, int b);
}
Now, you can add a default method to the Calculator interface that will be used to display a result for example :
Code:
@FunctionalInterface
public interface Calculator {
int calculate(int a, int b);
default void print(String result){
// … print result …
}
}
Finally, we can create a Lambda expression with that interface :
Code:
Calculator c = (a, b) -> a + b;
Like you can see with those simple examples, Java 8 language features will offer a new way to Android developers to improve their productivity. Thanks to the developer preview of Android N, you can try these features right now.
Don't hesitate to share your feedbacks with me.
Thanks.
Sylvain
Is it worth going to Jack right now, though?
I've read that it's slower in build time than the normal configuration, and as some apps already take a huge amount of time to compile, I'm not sure if it's worth it.
Also, lambdas are only syntactic sugar, right? Behind the scenes, everything is still the same.
AndroidDeveloperLB said:
Is it worth going to Jack right now, though?
I've read that it's slower in build time than the normal configuration, and as some apps already take a huge amount of time to compile, I'm not sure if it's worth it.
Also, lambdas are only syntactic sugar, right? Behind the scenes, everything is still the same.
Click to expand...
Click to collapse
For the moment, I just tried on small projects. So, it was not so slow during build time. May be on big projects ?
These new features are not a revolution for sure, but it's interesting to have the choice to use it in the future when you develop Android apps. Be able to have some functional programming features is a good thing.
For Lambdas, it's not really the same thing on the bytecode. On Java 8 desktop apps, some benchmarks showed that using Lambdas is very often faster.
sylsau said:
For the moment, I just tried on small projects. So, it was not so slow during build time. May be on big projects ?
These new features are not a revolution for sure, but it's interesting to have the choice to use it in the future when you develop Android apps. Be able to have some functional programming features is a good thing.
For Lambdas, it's not really the same thing on the bytecode. On Java 8 desktop apps, some benchmarks showed that using Lambdas is very often faster.
Click to expand...
Click to collapse
I see.
For Lambdas, I don't know. It's just my guess that whatever you write is converted to normal code that you probably should have written without lambdas.
Perhaps the JDK has some optimizations for it.
EDIT: it seems there is a difference:
http://www.oracle.com/technetwork/java/jvmls2013kuksen-2014088.pdf
http://blog.takipi.com/benchmark-how-java-8-lambdas-and-streams-can-make-your-code-5-times-slower/
Nice. Wonder if it's this way on Android too.
AndroidDeveloperLB said:
I see.
For Lambdas, I don't know. It's just my guess that whatever you write is converted to normal code that you probably should have written without lambdas.
Perhaps the JDK has some optimizations for it.
EDIT: it seems there is a difference:
http://www.oracle.com/technetwork/java/jvmls2013kuksen-2014088.pdf
http://blog.takipi.com/benchmark-how-java-8-lambdas-and-streams-can-make-your-code-5-times-slower/
Nice. Wonder if it's this way on Android too.
Click to expand...
Click to collapse
Thanks for the links. Really interesting.
It seems you were right. Lambdas and Stream can make execution slower.
sylsau said:
Thanks for the links. Really interesting.
It seems you were right. Lambdas and Stream can make execution slower.
Click to expand...
Click to collapse
They do? I thought the data and graphs show Lambdas are faster. Are you sure?
AndroidDeveloperLB said:
They do? I thought the data and graphs show Lambdas are faster. Are you sure?
Click to expand...
Click to collapse
It depends the way you use it like said on takipi blog. If they are well used, it can make your code run faster however. It's always the same thing, it depends from your implementation and the way you use it.
sylsau said:
It depends the way you use it like said on takipi blog. If they are well used, it can make your code run faster however. It's always the same thing, it depends from your implementation and the way you use it.
Click to expand...
Click to collapse
So there is no definite conclusion? So my guess is that for Android it's too early to see difference between normal code and Lambda.
Pretty Information
such a nice post, i am studying the java but it is totally different why can you please explain what the java in book is different the java in applications??
Regards Junaid Shahid
---------- Post added at 02:47 PM ---------- Previous post was at 02:42 PM ----------
AndroidDeveloperLB said:
So there is no definite conclusion? So my guess is that for Android it's too early to see difference between normal code and Lambda.
Click to expand...
Click to collapse
:good:
@sylsau thanks bro nice guide :good:
junaidshahidcom said:
such a nice post, i am studying the java but it is totally different why can you please explain what the java in book is different the java in applications??
Regards Junaid Shahid
---------- Post added at 02:47 PM ---------- Previous post was at 02:42 PM ----------
:good:
Click to expand...
Click to collapse
They are almost the same. The pure Java is still there, but some classes do not exist or have less functions, because Android is a mobile OS.
There is just another layer of the framework itself, that you need to learn, when developing for Android.
Thanks For Elaburation
AndroidDeveloperLB said:
They are almost the same. The pure Java is still there, but some classes do not exist or have less functions, because Android is a mobile OS.
There is just another layer of the framework itself, that you need to learn, when developing for Android.
Click to expand...
Click to collapse
Can you suggest me how to become a good developed of Java Along Android?
junaidshahidcom said:
Can you suggest me how to become a good developed of Java Along Android?
Click to expand...
Click to collapse
Learn both (first Java of course).
You can watch "the new boston" videos to get started:
https://thenewboston.com/videos.php
You can also read a lot on Google's website, but only after you are good with Java.
awesome
AndroidDeveloperLB said:
Learn both (first Java of course).
You can watch "the new boston" videos to get started:
https://thenewboston.com/videos.php
You can also read a lot on Google's website, but only after you are good with Java.
Click to expand...
Click to collapse
the website you referred is awesome, i will try to learn all programming languages from here <3
regards Junaid Shaid
princevirus said:
@sylsau thanks bro nice guide :good:
Click to expand...
Click to collapse
No problem. I'm going to publish more tutorials very soon
Thanks.
Android小楼阁-QQ群 439637151
来自搭载Android 2.3 GingerBread的华为Y220-T10
Hello,
I made a new tutorial available on XDA Forum. It shows you how to implement a Navigation Drawer with a Toolbar on Android.
Don't hesitate to discover it : http://forum.xda-developers.com/android/software/tutorial-implement-navigation-drawer-t3388990
Sylvain
sylsau said:
Hello,
I made a new tutorial available on XDA Forum. It shows you how to implement a Navigation Drawer with a Toolbar on Android.
Don't hesitate to discover it : http://forum.xda-developers.com/android/software/tutorial-implement-navigation-drawer-t3388990
Sylvain
Click to expand...
Click to collapse
hi, can that commit can help to use java 8 on M?
https://github.com/kogone/android_build/commit/ac67b54797f06b67a1ce0e39aa8528dbffac3b92

Categories

Resources