Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including AAR into flutter project (Android Studio) #148037

Open
gingu83 opened this issue May 9, 2024 · 6 comments
Open

Including AAR into flutter project (Android Studio) #148037

gingu83 opened this issue May 9, 2024 · 6 comments
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@gingu83
Copy link

gingu83 commented May 9, 2024

Steps to reproduce

Hi, I'm using an our external aar package connecting to an external usb device (with some C code).
This package works perfectly in a simple Android project and I added it into flutter project with success. I able to compile and create a apk package but when I try to run app on device, I can't try to connect to the device. How can I do? is there some kind of compilations for flutter project different to a simple nativa java one?
Please help me
Thank you

Expected results

Correctly connection on usb device and work

Actual results

Connection to usb device failed

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
@huycozy huycozy added the in triage Presently being triaged by the triage team label May 9, 2024
@huycozy
Copy link
Member

huycozy commented May 9, 2024

Hi @gingu83
Could you share a minimal sample project for this case?

I can't try to connect to the device

Could you please be more specific? Does it have any error or warning?

And what is your Flutter version? (please provide the output of flutter doctor -v) Thanks!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 9, 2024
@gingu83
Copy link
Author

gingu83 commented May 9, 2024

Hi this is the flutter doctor log

/Users/Gingu/flutter/bin/flutter doctor --verbose
[!] Flutter (Channel stable, 3.16.9, on macOS 14.0 23A344 darwin-arm64, locale it-IT)
• Flutter version 3.16.9 on channel stable at /Users/Gingu/flutter
! The flutter binary is not on your path. Consider adding /Users/Gingu/flutter/bin to your path.
! Warning: dart on your path resolves to /usr/local/Cellar/dart/3.3.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/Gingu/flutter. Consider adding /Users/Gingu/flutter/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4145645 (4 mesi fa), 2024-01-25 10:06:23 -0800
• Engine revision f40e976bed
• Dart version 3.2.6
• DevTools version 2.28.5
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/Gingu/Downloads/adt-bundle-mac-x86_64-20131030/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.13.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version unknown)
• Android Studio at /Applications/Android Studio 3.4 Preview.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to determine Android Studio version.
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio 2.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2023.2)
• Android Studio at /Applications/Android Studio 3.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[!] Android Studio (version unknown)
• Android Studio at /Applications/Android Studio 4.0 Preview.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to determine Android Studio version.
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] Connected device (4 available)
• iPhone di Gingu (mobile) • 00008130-001A5C280E92001C • ios • iOS 17.4.1 21E236
• iPhone 15 Plus (mobile) • 16D679BA-90C6-4A48-A9EC-FDBB64FD0126 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.0 23A344 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.119

[✓] Network resources
• All expected network resources are available.

! Doctor found issues in 4 categories.
Process finished with exit code 0

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 9, 2024
@gingu83
Copy link
Author

gingu83 commented May 9, 2024

This is the build.gradle

plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

android {
namespace "com.example.altrotestkisok.kioskflutterandroid"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.altrotestkisok.kioskflutterandroid"
    // You can update the following values to match your application needs.
    // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
    minSdkVersion 24
    targetSdkVersion 34
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation files('libs/ConnectionLayer-3.0.41-20230130-release.aar')

}

}

flutter {
source '../..'
}

@gingu83
Copy link
Author

gingu83 commented May 9, 2024

My aar library is a custom library and it worka perfectly in a simple android java project. In flutter one, it's imported correctly and classes, objects, ecc. and some calls work perfectly but not all. What can I do? I want to compile it (it's an only flutter android project and I don't need other platform) in the same way

@gingu83
Copy link
Author

gingu83 commented May 9, 2024

@huycozy is it possibile why library is a 32 bit?

@huycozy
Copy link
Member

huycozy commented May 10, 2024

Could you share a complete sample project on GitHub? And please add license the code in the repository under some open-source license (e.g. MIT, Apache, BSD, GPL) so that we may look into it.

If AAR lib can't be shared, please provide the error/warning output so that we have more information to investigate further. Thank you.

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

2 participants