flutter i18n plugin not working in android studio 3.4.0 - android-studio

flutter i18n plugin not working in android studio 3.4.0
i18n.dart file not generated automatically in Android Studio
version of AS 3.4.0
flutter -version 1.5.4
flutter i18n-version 1.0.2

You can use following approach. It's tested with flutter web and mobile
Include this in pubspec.yaml
dependencies:
#i18n
flutter_i18n:
flutter:
assets:
- assets/i18n/
Dummy main page widget:
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new MaterialApp(
//i18n stuff
localizationsDelegates: [
FlutterI18nDelegate(
useCountryCode: false,
fallbackFile: 'en',
path: 'assets/i18n',
),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
home: new LoginPage(),
);
}
Put this in assets/i18n/en.json
{
"login_screen": {
"button": {
"login": "LOGIN"
}
}
}
Now use these strings as following:
Text(FlutterI18n.translate(
context, 'login_screen.button.login'))

Related

Loading url in web view doesn't work on web Flutter

I'm using flutter_inappwebview: 6.0.0-beta.22 package and I'm opening the Stripe onboarding process in an in-app web view.
While on Android emulator works as expected and the page is loaded, when I launch the web view on the web app(launched in release mode run -d chrome --release --web-hostname localhost --web-port 5000 ) the page doesn't load and on console I get the message
url is: https://connect.stripe.com/setup/c/acct_1MFXNcFwHPwkSrfO/jug2SEGbwzAq
NoSuchMethodError: method not found: 'toString' on null
js_primitives.dart:47 at a6J.aA (http://localhost:5000/main.dart.js?version=9:56217:6)
js_primitives.dart:47 at fY.Gq (http://localhost:5000/main.dart.js?version=9:82446:12)
js_primitives.dart:47 at fY.e0 (http://localhost:5000/main.dart.js?version=9:82409:6)
js_primitives.dart:47 at IQ.Cc (http://localhost:5000/main.dart.js?version=9:82306:3)
js_primitives.dart:47 at IQ.eK (http://localhost:5000/main.dart.js?version=9:82255:16)
js_primitives.dart:47 at IQ.e0 (http://localhost:5000/main.dart.js?version=9:82634:8)
js_primitives.dart:47 at Ai.Cc (http://localhost:5000/main.dart.js?version=9:82306:3)
js_primitives.dart:47 at Ai.eK (http://localhost:5000/main.dart.js?version=9:82255:16)
js_primitives.dart:47 at Ai.kE (http://localhost:5000/main.dart.js?version=9:82417:32)
js_primitives.dart:47 at Ai.wy (http://localhost:5000/main.dart.js?version=9:82382:6)
when clicking on any of the js_primitives.dart:47links on the right it shows this error
Could not load content for org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_primitives.dart (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)
Now, the url print is from the screen initState and is correct.
This is the Screen:
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:universal_platform/universal_platform.dart';
import 'package:url_launcher/url_launcher_string.dart';
import '../utilities.dart';
class StripeOnboardScreen extends StatefulWidget {
final String onboardUrl;
const StripeOnboardScreen({Key? key, required this.onboardUrl})
: super(key: key);
#override
State<StripeOnboardScreen> createState() => _StripeOnboardScreenState();
}
class _StripeOnboardScreenState extends State<StripeOnboardScreen> {
dynamic backButton = UniversalPlatform.isWeb
? UniversalPlatform.isIOS
? CupertinoIcons.back
: Icons.arrow_back
: Icons.arrow_back;
double fontSize = Utilities.fontSize;
final GlobalKey webViewKey = GlobalKey();
InAppWebViewController? webViewController;
InAppWebViewSettings settings = InAppWebViewSettings(
javaScriptEnabled: true,
javaScriptCanOpenWindowsAutomatically: true,
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true,
iframeAllow: "camera; microphone",
iframeAllowFullscreen: true);
late PullToRefreshController pullToRefreshController;
double progress = 0;
// Create a webview controller to control the webview and get information
// about its current state
final urlController = TextEditingController();
#override
void initState() {
super.initState();
print('url is: ${widget.onboardUrl}');
pullToRefreshController = (kIsWeb
? null
: PullToRefreshController(
settings: PullToRefreshSettings(
color: Colors.blue,
),
))!;
}
#override
void dispose() {
super.dispose();
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
// Show a "Back" button in the app bar if the webview is displaying
// a page other than the initial page
leading: IconButton(
icon: Icon(backButton),
color: Colors.redAccent,
onPressed: () {
Navigator.pop(context);
}),
),
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: InAppWebView(
key: webViewKey,
initialUrlRequest: URLRequest(
url: WebUri(widget.onboardUrl, forceToStringRawValue: true)),
initialSettings: settings,
pullToRefreshController: pullToRefreshController,
onWebViewCreated: (controller) {
webViewController = controller;
},
onLoadStart: (controller, url) {
setState(() {
urlController.text = widget.onboardUrl;
});
},
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT);
},
shouldOverrideUrlLoading: (controller, navigationAction) async {
var uri = navigationAction.request.url!;
if (![
"http",
"https",
"file",
"chrome",
"data",
"javascript",
"about"
].contains(uri.scheme)) {
await canLaunchUrlString(widget.onboardUrl)
? await launchUrlString(widget.onboardUrl)
: throw 'Could not launch ${widget.onboardUrl}';
// and cancel the request
return NavigationActionPolicy.CANCEL;
}
return NavigationActionPolicy.ALLOW;
},
onConsoleMessage: (controller, consoleMessage) {
print('consoleMessage is : $consoleMessage');
},
),
),
);
}
}
I added the script in the head as per docs but here is the index.html so you can have look at it
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>fixit</title>
<!-- <meta name="google-signin-client_id" content="YOUR_GOOGLE_SIGN_IN_OAUTH_CLIENT_ID.apps.googleusercontent.com">-->
<meta name="google-signin-client_id"
content="147151203258-clupo1g18oueig38uq8nts5mnkgug13e.apps.googleusercontent.com">
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
<script type="application/javascript" src="/assets/packages/flutter_inappwebview/assets/web/web_support.js" defer></script>
</head>
<!--<body>-->
<body id="app-container">
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-messaging.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-storage.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-remote-config.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "xx",
authDomain: "xx",
databaseURL: "xx",
projectId: "xx",
storageBucket: "xx",
messagingSenderId: "xx",
appId: "xx",
measurementId: "xx"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
<!-- firebase.analytics();-->
</script>
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
//navigator.serviceWorker.register("/flutter_service_worker.js");
navigator.serviceWorker.register("/firebase-messaging-sw.js");
});
}
</script>
<script src="main.dart.js?version=9" type="application/javascript"></script>
</body>
</html>
Can you spot what I'm doing wrong?
this is my flutter doctor
[✓] Flutter (Channel stable, 3.3.9, on macOS 12.5.1 21G83 darwin-arm, locale en-IT)
• Flutter version 3.3.9 on channel stable at /Users/vincenzocalia/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b8f7f1f986 (3 weeks ago), 2022-11-23 06:43:51 +0900
• Engine revision 8f2221fbef
• Dart version 2.18.5
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/vincenzocalia/Library/Android/sdk
• Platform android-33, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• 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.12+0-b1504.28-7817840)
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.5.1 21G83 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.124
HTTP Host availability check is taking a long time...[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Afters stripping down the Screen to the bare minimum (So no InAppWebViewController, PullToRefreshController, no callbacks) it finally displays the link.
Unfortunately Stripe doesn't allow it to be in a iFrame so I get the web an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'.
So unless there is some settings to put in place for the plugin, I have to open it a new window for the app running on the web..

How can i downgrade the gradle on project kotlin multiplatform to use a Android Studio Stable version?

Recently i started to work on a kotlin multiplatform project, i did not have any previous experience when i started, and i got the project with its base already created. The developer that create the project had the ideia to use the compose library on android development part.
Then he quit the job, and i started in it.
But i choose to not use compose because of the rush on deliver the application.
So the project gradle version is currently on 6.8 and android plugin on 7.0.0-alpha05
but i want to downgrade to stop to use the Android Studio on Canary version, and use on a stable version. But when i downgrade the gradle i am getting this error:
A problem occurred configuring project ':shared'.
> Failed to notify project evaluation listener.
> /Users/jhonata/Documents/Projetos/Aurea/quicktendr-mgmt/shared/src/main/AndroidManifest.xml (No such file or directory)
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':shared'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:68)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$400(LifecycleProjectEvaluator.java:51)
at org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate.run(LifecycleProjectEvaluator.java:191)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at ...
gradle properties:
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
shared gradle:
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-parcelize")
id("dev.icerock.mobile.multiplatform-resources")
kotlin("plugin.serialization")
}
android {
configurations {
create("androidTestApi")
create("androidTestDebugApi")
create("androidTestReleaseApi")
create("testApi")
create("testDebugApi")
create("testReleaseApi")
}
}
kotlin {
// jvm()
android()
ios {
binaries {
framework {
baseName = "shared"
when (val target = this.compilation.target.name) {
"iosX64" -> {
export(Deps.Decompose.iosX64)
}
"iosArm64" -> {
export(Deps.Decompose.iosArm64)
}
else -> error("Unsupported target: $target")
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
api(Deps.Decompose.decompose)
api(Deps.coroutines)
implementation(Deps.ktxSerializationJson)
implementation(Deps.ktorCore)
implementation(Deps.ktorSerialization)
implementation(Deps.kissMeCommon)
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("dev.icerock.moko:mvvm-core:0.10.1")
implementation("dev.icerock.moko:mvvm-livedata:0.10.1")
api("dev.icerock.moko:resources:0.15.1")
api("dev.icerock.moko:mvvm:0.9.1")
implementation("io.ktor:ktor-client-logging:1.4.2")
implementation("io.ktor:ktor-client-auth:1.4.2")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
// val mobileMain by creating {
// dependsOn(commonMain)
// dependencies {
//
// }
// }
val androidMain by getting {
dependencies {
implementation(Deps.ktorAndroid)
implementation(Deps.kissMeAndroid)
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13")
}
}
val iosMain by getting {
dependencies {
implementation(Deps.ktorIOS)
implementation(Deps.kissMeIOS)
}
}
val iosTest by getting
// val jvmMain by getting {
// dependencies {
// implementation("io.ktor:ktor-client-okhttp:1.4.2")
// }
// }
named("iosX64Main") {
dependencies {
api(Deps.Decompose.iosX64)
}
}
named("iosArm64Main") {
dependencies {
api(Deps.Decompose.iosArm64)
}
}
}
}
multiplatformResources {
multiplatformResourcesPackage = "com.quicktendr.mgmt" // required
iosBaseLocalizationRegion = "es" // optional, default "en"
}
android {
compileSdkVersion(29)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework =
kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
gradle:
buildscript {
repositories {
gradlePluginPortal()
jcenter()
google()
mavenCentral()
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/jetbrains/kotlin-native-dependencies")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
maven("https://dl.bintray.com/icerockdev/plugins")
}
dependencies {
val kotlinVersion = "1.4.31"
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
classpath("com.android.tools.build:gradle:4.2.1")
classpath("com.github.jengelman.gradle.plugins:shadow:5.2.0")
classpath("dev.icerock.moko:resources-generator:0.15.1")
classpath("com.google.gms:google-services:4.3.5")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.5.2")
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven("https://dl.bintray.com/arkivanov/maven")
maven("https://dl.bintray.com/icerockdev/moko")
maven("https://dl.bintray.com/netguru/maven/")
maven("https://repo.repsy.io/mvn/chrynan/public")
maven("https://jitpack.io")
}
}
If you just want to downgrade gradle, you can downgrade gradle in the gradle properties file which you posted.
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
You would need to set this to the latest version supported by Android Studio 4.2.1. There are also compatibility considerations with the Android gradle plugin. You can see a compatibility matrix for that here:
https://developer.android.com/studio/releases/gradle-plugin#4-2-0
Please be aware that if your project was using things like compose which relied on particular versions of AGP/Gradle, you might need to rewrite those pieces. It is okay to use the canary versions of android studio or recent versions of intellij - unless you are hitting some issue. You can use compose and old view classes together using AndroidView
https://developer.android.com/jetpack/compose/interop/interop-apis#views-in-compose

Facing a big issue in importing package to flutter (Andriod Studio). I have tried all the methods from other solutions

I am trying to import the URL launcher package but it seems that the flutter is not able to recognize the package.
I have mentioned about the package in pubspec.yaml file.
I have also used the command flutter packages get. I can see the package imported in external libraries but not able to import it. There seems to be a problem with
import 'package:url_launcher/url_launcher.dart';
For your reference, I have pasted my error message, my code and pubspec.yaml file too
I received the following error
Error: Could not resolve the package 'url_launcher' in 'package:url_launcher/url_launcher.dart'.
lib/main.dart:2:8: Error: Not found: 'package:url_launcher/url_launcher.dart'
import 'package:url_launcher/url_launcher.dart';
^
lib/main.dart:8:5: Error: The method 'launch' isn't defined for the class 'XylophoneApp'.
- 'XylophoneApp' is from 'package:xylophone/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'launch'.
launch('https://flutter.dev');
^^^^^^
The following is my code
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
void main() => runApp(XylophoneApp());
class XylophoneApp extends StatelessWidget {
launchURL() {
launch('https://flutter.dev');
}
#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Xylophone'),
),
body: Center(
child: RaisedButton(
onPressed: launchURL,
child: Text('Show Flutter homepage'),
),
),
),
);
}
}
This is my pubspec.yaml file
name: xylophone
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
url_launcher: ^5.4.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
Always restart the program after importing any package.
Use the run button instead of the hot reload or hot restart button

how can i migrate a flutter project to androidx:Execution failed for task ':app:preDebugBuild'. > Android dependency 'androidx.versionedparcelable

i added a geolocator package in my flutter project and whenever i run i get errors about androidx compatibility and
Execution failed for task ':app:preDebugBuild'.
Android dependency 'androidx.versionedparcelable:versionedparcelable' has different version for the compile (1.0.0) and runtime (1.1.0) classpath. You should manually set the same version via DependencyResolution
i added this in android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true
I have try changing the build version but it's not working. I also try some solutions proposed by github pasting
i added this under the buidscript in android/build.gradle
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.1"
}
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
all what i enter image description heredid mas useless
i was able to find out an answer after sometimes. I just needed to update flutter
and the followinng in the android/build.gradle under buildscript
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.1"
}
}
}
}
and add the following in the android/gradle.properties file
android.useAndroidX=true
android.enableJetifier=true

Android Studio 2.0 Preview 5, linking ndk app fails to locate module .so and .a

I have an ndk project with two modules:
abwrenderer - native library module
app - native and java hybrid, glues java to the abwrenderer
I just updated to AS 2.0 Preview 5 this morning, and encountered some gradle related issues.
I upgraded to gradle-2.10 and switched to gradle-experimental:0.6.0-alpha5. When attempting to debug, an ndk build is triggered and I run into the following problem:
Error:error: C:\android\projects\foo\abwrenderer\build\intermediates\binaries\debug\obj\armeabi-v7a\libabwrenderer.so: No such file or directory
Now when I was on gradle-2.9 & gradle-experimental:0.6.0-alpha3, the libraries were built in this directory. After this morning's upgrades, the libraries are now located in:
C:\android\projects\foo\abwrenderer\build\libs\abwrenderer\shared\armeabi-v7a\debug
Is there a way to update the search location for project dependencies that build libraries?
For reference, I define the dependency on abwrenderer project as follows (build.gradle (app)):
android.sources {
main {
jni {
source {
srcDirs 'src/main/jni'
}
dependencies {
project ":abwrenderer" buildType "debug" linkage "shared"
}
}
jniLibs {
source {
srcDirs 'src/main/libs'
}
}
}
}
And build.gradle for abwrenderer project is as follows:
apply plugin: "com.android.model.native"
model {
android {
compileSdkVersion = 23
}
android.ndk {
moduleName = "abwrenderer"
cppFlags.addAll(["--std=c++11",
"-fexceptions",
"-frtti"])
ldLibs.addAll(["android", "EGL", "GLESv3", "log", "dl"])
stl = "c++_static"
debuggable = true
}
android.sources {
main {
jni {
exportedHeaders {
srcDir "src/main/jni"
}
}
}
}
}
I have invalidated caches and restarted, done a clean build, etc. Any help would be greatly appreciated!
Your defaultConfig and ndk blocks were missing some info. They should look similar to this:
defaultConfig {
applicationId = 'com.myapp.abwrenderer'
minSdkVersion.apiLevel = 13
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = '1.0'
}
ndk {
platformVersion = 21
moduleName = 'abwrenderer'
toolchain = 'clang'
stl = 'gnustl_static'
cppFlags.addAll(['-std=c++11'])
ldLibs.addAll(['android', 'EGL', 'GLESv3', 'log', 'dl'])
}
You should take a look at the following NDK sample from Google to see how they did it: hello-libs

Resources