Setting up a modular project in Android Studio - android-studio

I'm coming from the Visual Studio world of solutions, where each solution can consist of multiple projects that can refer to each other.
What I want to do is create a modular Android project in Android Studio such that all my code doesn't live in one huge app project. However, it seems terribly difficult to do this, so much so that I am sure I am doing something wrong.
I created a blank project called MyProject. This creates a project with the name MyProject and a package com.sohum.myproject. There is a single app project contained within containing no source files.
I now want to add another module under the same namespace (e.g. com.sohum.myproject.library1). However, it seems when I try to add a new module via the menu, I can only do so into a com.sohum.library1 project. How do I get it to use the same package as the project?
My end goal is to have all my modules under the com.sohum.myproject package, referencing each other. For example:
com.sohum.myproject.application will be the entry point. It might depend on com.sohum.myproject.library1 and com.sohum.myproject.someotherlibrary. And I would like to see all of these modules when I open the MyProject file.

You can click File > New > New Module. Then choose Android Library and enter the details.
Reference: https://developer.android.com/studio/projects/android-library

Another way is to set up the project in a subpackage when creating it.
For example, create a project MyProject in a root directory. Call the application Application and rename the package to be com.sohum.myproject.app instead of just com.sohum.myproject. Now any new modules created will be added below the com.sohum.myproject package space.

Related

Seperate python envoirment from global envoirment

I have a problem.
I would like to create/add costume library's for a project in a virtual environment in python with an IDE. Sealed off of the global environment.
How did this problem occurred?
I dragged the costum-selfmade- library's to the new project and I started using them/changing them. Because there is a init file in this folder, other projects become dependent on these libraries. I fixed it to change the library's names and added the project extension to it. But this is to dirty for my standards/ not sustainable. So I would like to somehow add these custom libraries to a virtual environment and prevent it from creating unwanted dependencies.
Own research for solution:
I have looked up if there is a way to create a library in a global env. No result.
Checked the VENV if there is a map with library's/packages. There is one, but I dont know how don't I'm supposed to develop in the virtual environment. If this is the way, please tell me your experience.
Project structure:
Main folder project A/ stript folder / transactions_handler(class that helps transactions)
Main folder project B/ stript folder / transactions_handler(class that helps transactions)
problem, the classes in project A that use transactions_handler excidently use the class of project B instate. Very tricky.

Move SafeArgs in multi module project

I im working on modularizationing android project.
I im using Navigation Component library.
I have main nav_graph.xml in :app module.
I want to move generated SafeArgs files to modules directories.
I didnt add androidx.navigation.safeargs.kotlin plugin to modules, except :app module.
I already move one testing generated args file into ordering module by gradle script after generateSafeArgs task finished. But my IDE cant see it in code. Everybody knows why IDE cant see my moved file?
SafeArgs files are generated automatically so changes you make to them likely won't be reflected.
You'll need to add the safeArgs plugin to the modules where you want to use the navigation component and it'll automatically generate the needed files.

How to publish solution with class library projects in IIS

I have an Asp.Net Web Api solution with 3 class library projects that are referenced from the main project. I have published the main project to another server on site - MySite/Main. I am unable to figure out how to publish the class library projects to location like so -
MySite/CL1
MySite/CL2
MySite/CL3
This shall enable the main project to reference them properly. How should I go about it?
When you build your web project all the referenced libraries are being copied to the bin folder (check for yourself). This folder is also being published.
If you use IIS it will automatically look for assemblies in the bin folder so you shouldn't worry about making the folder structure to be the same as in your local environment.
So the only thing you should worry about is referencing libraries properly.
The website project is the only one which should be published. You don't need to publish class libraries (I don't think you can do this using Visual Studio)

How to import existing node.js module into Intellij IDEA?

I have an existing Node.js codebase, forked from GitHub. Now I want to import it to the Intellij IDEA 13 (ultimate version, which supports Node.js). When I simply try to import the project from the root folder of my existing code, IDEA doesn't add the 'lib' folder, where all the sources are. It should be simple, but I cannot figure it out. Any hints?
Well, I've figured out a workaround, but not sure if it's the best solution. One can just create a new project of type "Web", and point it to the directory containing the module's sources. Then IDEA understands the whole structure, and you can create run configurations with Node.js.
In order to get additional Node features, like Intellisense for standard Node APIs, you'll still want to configure the project to be a Node project:
Open the Preferences window
Click Languages & Frameworks → Node.js and NPM
In the section Coding Assistance you'll see if Node.js Core library is [not] enabled. If it is enabled, there's nothing more to do. If not click the Enable button
Leave For the whole project checked, and click Configure
The text should now change to Node.js Core library is enabled.
Another workaround:
If you have a version controlled Node app with no local changes, you could also create a new project of type "Node.js and NPM", point that to the directory. Then just use any standard settings.
After the project is created, you can just revert the files overwritten by IDEA (e.g. app.js and package.json), delete any new directories and files, and you will get the additional Node features in your project.
Intellij 15 Professional Edition:
Import a new project -> Select the base folder of the project -> choose import form existing source.
When Intellij is done it wont look correct so do the following:
1) Project Structure CMD + ;
2) Go to Modules
3) Add a new module and select Node/Npm (if you dont have it then add a new plugin)
4) Point the source of the project to the base folder and click apply.

Which project file element specifies a WinRT class library project and not .NET?

I have a WPF class library that I want to port to be a WinRT class library. My plan is to copy the project, edit the project file so that it's a WinRT project instead of WPF, and see where I stand.
However, I cannot find which element in the project file makes it a WinRT project, and not .NET. Any ideas?
I've tried everything including diffing the project file with a WinRT class library project file, and slowly changing it over, but the WPF project never switches to WinRT in VS's eyes.
Sorry if this sounds nuts, I'm looking for the quickest way to find out how much work I need to do to port across.
Thanks
I'd take a different approach to that:
First I'd create a new Windows Store apps class library project.
Then I'd copy all the files from the existing WPF class library folder to the new Windows Store apps class library project folder (without overwriting any of existing files)
In the Solution Explorer window I'd enable Show All Files to see all the copied files and folders.
I'd multi select all the items in the treeview that belong to the project and click on Include In Project from the context menu.
At this point the only thing potentially still missing would be settings at the project level such as conditional compilation symbols and missing references which could easily be added by comparing both projects in Visual Studio or just trying to compile the new projects and seeing what goes wrong.

Resources