How to specify version for Android aar? - android-studio

I'm creating a aar from my library project. But if I add it in another project its treated as "unspecified". (name="MyLibrary-unspecified") If I click the .aar its also saying "unknown (version unknown)". How to set up this properly? (I name the file MyLibrary-1.1.0.aar but this does not help)

Related

Android Studio Library Module to AAR file for Dynamic Loading

I have an Android Studio project that has two modules:
app (dependencies on common.jar and ext)
ext (dependecies on common.jar)
common.jar has most of the model logic of my app.
Right now the app uses reflection to find and instantiate the extension service. Since the class is in the APK the nornal classloaded finds it.
Now I want to sever the app's dependency on the ext module and use DexClassLoader to find the service class from an AAR file.
I have used java and the AndroidSDK dx tool to create a simple JAR file to verify I have the dynamic loading working ... I can find, instantiate, and execute methods from the test JAR file.
I just can't figure out how to make Android Studio generate the AAR file for my library module.
I found an answer burried in:
Create aar file in Android Studio
I saw this before ... but missed the key missing information ...
Using Gradle menu ... I have never used or noticed this before.

Opened project in android studio and all packages/symbols are marked as incorrect

I am trying to contribute to my first open source project but after forking and cloning from the repo, all files are marked as an error.
Sample error
This is after selecting a source folder.
Current project source
Under package it says: package name does not correspond to filepath
... but I have this
misnamed packages?
Android studio isn't picking up those libraries.
IME there are 2 ways of importing these (I have only had success with the first):
1) copy the source parallel to your own (ie example.com)
2a) include the jar in a libs folder and tell AS to look out for it. (right click will typically provide a good option that I can't recall)
2b) because Android can struggle (ie I couldn't do it, though inroads may have been made since) with importing jars, you may need to use AAR's (android library packages, Android Archive Library (aar) vs standard jar)
However, because this is an open source project, this should all be handled auto-magically for you via the gradle scripts included in the distro.

Android studio - Unable to add library from outside folder

I am trying to develop an android library and an app using Android Studio. For this, I need to use the library directly in my app project, so I can modify both the library sources and app sources easily.
I am using versions: Android Studio 3.1.2 and Gradle 4.4
First of all, I have tried both methods described in the documentation, but both methods duplicate the library.
Second, I tried to add the library from outside folder as described here, but I get the error:
Unable to find module with Gradle path ':mytestlibrary3-release' (needed by module 'app'.)
My test structure is like this:
In "Workspace" folder I have the app folder "MyApplication4" and library folder "MyTestLib3" containing the library module "mytestlibrary3" (I attached screens)
The application settings.gradle:
include ':app'
include ':mytestlibrary3-release'
project(':mytestlibrary3-release').projectDir = new File(settingsDir, '../MyTestLib3/mytestlibrary3')
and the application build.gradle:
...
dependencies {
...
implementation project(':mytestlibrary3-release')
}
What am I doing wrong here? My purpose is to use the code directly (similar to Eclipse "Add Project to Build Path" or link src folder to source) or to build and use the library as simple and elegant as possible.

Can't compile freshly made extension library

I cannot successfully compile an extension library that is freshly created using the Customization Project -> Extension Library -> Create New.
When compiling the freshly created extension library, I get the following error in the output, but no errors show in the error report:
1>C:\Program Files (x86)\Acumatica ERP\SilcotekDev\App_Data\Projects\ManufacturingTest\ManufacturingTest\Test.cs(6,7,6,9): error CS0246: The type or namespace name 'PX' could not be found (are you missing a using directive or an assembly reference?)
I have another custom extension library which had compiled successfully in the past, but today is not. Here is the full error list from that project's compilation:
I do have a custom DAC which I imported directly into the extension library, and I had compiled it before with that DAC added. Today it won't compile at all.
With update 3 of version 6.1 Acumatica has changed the target framework for its websites from 4.5.1 to 4.5.2. Unfortunately, the target version of the Addon.csproj VS project from the \App_Data\WebsiteSolution\Addon folder was not updated to .Net Framework 4.5.2 until update 9 of ver. 6.1 (build #6.10.0945). Because of the lower target version set for extension library VS project, VS cannot build the dll and therefore copy it to the Bin folder of your website.
There are 2 ways to resolve this type of an issue:
Change target framework version in VS for your extension library project:
Open the Addon.csproj VS project in a text editor, like NotePad, and change the target framework to v4.5.2 as shown in the screenshot below (located in the \App_Data\WebsiteSolution\Addon folder inside your Acumatica website root folder). Create a new customization project inside Acumatica, then in Customization Manager create extension library for the new project
There are a lot of things that could cause this problem.
1. is your program set up to read the PX namespace?
2. are you References setup the right way. You can always check by right clicking on the reference and selecting "Add reference"

Unable to create a blank working bridge.net project via visual studio template

Everytime I try to create a bridge.net new project I get the following error:
Could not add all required packages to the project. The following
packages failed to install from [the user appdata local
folder]\Microsoft\VisualStudio\14\extensions\IJHDC25V.XOU\Packages.
Bridge.1.10.0 : Solution is not opened or not saved. Please ensure you
have an open and saved solution.
Trying to build the project leads to the 'Bridge' namespace missing.
I did the following:
Download the bridge.net .vsix package from
https://visualstudiogallery.msdn.microsoft.com/dca5c80f-a0df-4944-8343-9c905db84757
Run the package
Create a new project -> Bridge.net -> Class Library
Named the project 'Demo'
I verified the folder exists and is populated. I've tried running Visual studio as an administrator and as a standard user.
How do I get a working blank Bridge.net project with the visual studio template?
I realise that this doesn't quite answer precisely the question asked but I don't use the VSIX package to create Bridge.NET projects, I just create a new (standard) class library and then use NuGet to add "Bridge". This adds the Bridge compiler and it adds a "demo.html" file and a basic "bridge.json" config file to get you started. (If you wanted to write a Bridge library and you didn't want the "starter park" items then you can add the NuGet package "Bridge.Min" instead).
The project needs to be saved to disk.
In Visual Studio under Tools / Options / Projects and Solutions tick the Save new projects when created checkbox.
Then create a new project.

Resources