ERROR:AAPT: error: resource style/Theme.AppCompat.light.NoActionBar - flutter

I am encountering a problem on my project build.
I am using the techno flutter.
I am using Android-Studio on Windows 11.
The error is:
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR:AAPT: error: resource style/Theme.AppCompat.light.NoActionBar (aka com.example.nysos:style/Theme.AppCompat.light.NoActionBar) not found.
error: failed linking references.
I have already cleared my gradle cache, used flutter clean, File > Invalidate caches > Clear file system chache and Local History > Invalidate and restart.
Could you please help me fixing this error ?

In Android Studio:
CTRL+SHIFT+F
Enter in the search bar: AppCompat
Change Theme.AppCompat.light.NoActionBar to Theme.AppCompat.Light.NoActionBar
Verify your versions in your flutter/android/app/build.gradle and flutter/android/build.gradle and it should work.

i face this issue don't know why but error clearly says about its location so i change styles.xml file code.
in flutter project go to you android>app>src>main>values>styles.xml
in styles.xml file change the line no 4
<style name="LaunchTheme"parent="Theme.AppCompat.Light.NoActionBar">
to
<style name="LaunchTheme"parent="#android:style/Theme.Light.NoTitleBar">
and line no 15
<style name="NormalTheme"parent="Theme.MaterialComponents">
to
<style name="NormalTheme"parent="#android:style/Theme.Light.NoTitleBar">

Related

Swift Package Manager failed extracting

I'm getting this Package Manager error, when switching to a different branch or cloning the project. Build fails and "Clean Build Folder" doesn't help.
Error:
failed extracting
'https://releases.amplify.aws/aws-sdk-ios/AWSConnect-2.26.6.zip'
which is required by binary target 'AWSConnect':
.../Library/Developer/Xcode/DerivedData/MyApp-cbgtlihuudupsqdzyjdbyvcwkilh/SourcePackages/artifacts/extract/AWSConnect
is not a directory
The following steps resolve the issue forcing all packages to download.
Product > Clean Build Folder
Delete DerivedData content (Preferences > Locations > Derived Data little arrow)
File > Packages > Reset Package Cache
Build
The Reset Package Cache step is the most important here. It forces all packages to download as if they where just added.
Another issue that can happen is if you have added a build configuration, make sure that you have replicated this build configuration name throughout all your in house libraries, frameworks and sub projects. If the project that uses your Library has no build configuration for the scheme you are building then it will not link and you will receive errors like:
failed extracting 'https://github.com/*.xcframework.zip' which is required by binary target 'BlahBlah': fchmod (file attributes) error: Operation not permitted

A problem occurred configuring project ':onesignal_flutter

FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':onesignal_flutter'.
Could not open proj remapped class cache for 2l1gu8tih6yuhcv6muthhswe2 (C:\Users\Asus.gradle\caches\5.6.2\scripts-remapped\build_16tcpowyxq2c9gqe2ghul7zlm\2l1gu8tih6yuhcv6muthhswe2\proj3e1f7b90744deb65198fe3e2308f45d5).
Could not open proj generic class cache for build file 'C:\src\flutter.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.6.1\android\build.gradle' (C:\Users\Asus.gradle\caches\5.6.2\scripts\2l1gu8tih6yuhcv6muthhswe2\proj\proj3e1f7b90744deb65198fe3e2308f45d5).
> Unexpected lock protocol found in lock file. Expected 3, found 0.
Could not get unknown property 'android' for project ':onesignal_flutter' of type org.gradle.api.Project.
How can i fix this error

How i can fix ':app:checkDebugDuplicateClasses' Error

I ran into a problem, I need Jitsi Meet and DartSIPUa in the project, but when I put them together it gives a duplicate error, I attached the log below. Can you also explain to me why my Flutter project that has JitsiMeet uses react-native-webrtc?
I tried for a long time to find what the reason might be, as long as JitsiMeet works separately from DartSIPUa, everything is fine, but I need them in one app, how can I do this?
Thank you all in advance for your help.
Log: https://pastebin.com/2RT30qEs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class org.webrtc.AndroidVideoDecoder found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)
Duplicate class org.webrtc.AndroidVideoDecoder$1 found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)
found a github issue
TLDR
I solved the two above problems as following:
First problem (:app:checkDebugDuplicateClasses)
solution was: Through android studio
File > Invalidate Caches/Restart...
Second problem (:app:mergeDebugJavaResource)
The solution was:
Due to the generated build file path exceeds the windows max path length of 255 characters.
Only trying to use short names to make sure the project path is not too long, solved the problem.
This is the path in my machine:
C:\Users\Hakim.gradle\caches\modules-2\files-2.1\io.flutter\x86_64_debug\1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119\1ae520cbbf7e14af867232784194366b3d1c3f34\x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.jar
You can find the path in your machine and change the long file name to short one.
else try downgrading your flutter version

Bypass Min SDK Version - or what else?

I am starting with flutter, and overall, I am getting an idea but have hit the wall with what I find to be one of the main reasons to consider migrating from HTML + JQueryMobile: speech to text implementation.
I have found the speech_to_text package (https://pub.dev/packages/speech_to_text#-installing-tab-), followed the instructions to :
1. update the pubspec.yaml file with the dependency &
2. instal the package from command line
3. import the package in the code
but have hit the wall with the minimum SDK requirements not being met by the package. Here is the error message:
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml
Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 21
declared in library [:speech_to_text]
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_manifest\debug\AndroidManifest.xml
as the library might be using APIs not available in 16 Suggestion:
use a compatible library with a minSdk of at most 16, or increase
this project's minSdk version to at least 21, or use
tools:overrideLibrary="com.csdcorp.speech_to_text" to force usage (may
lead to runtime failures)
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:speech_to_text]
C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\build\speech_to_text\intermediates\library_manifest\debug\AndroidManifest.xml
as the library might be using APIs not available in 16 Suggestion:
use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.csdcorp.speech_to_text" to force usage (may lead to runtime failures)
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s Exception: Gradle task assembleDebug failed with
exit code 1
Strangely, I have managed to bypass this once but can not find the
relevant piece of code in the app folder now. Worse, the mentioned file
> C:\Users\TOTAL\FlutterPro\Flutter4\flutter4\android\app\src\debug\AndroidManifest.xml
does not contain any reference to SDK, only this:
< <manifest
<xmlns:android="http://schemas.android.com/apk/res/android"
< package="com.example.flutter4">
> <!-- Flutter needs it to communicate with the running application
> to allow setting breakpoints, to provide hot reload, etc.
> -->
> <uses-permission android:name="android.permission.INTERNET"/> </manifest>
As for the other mentioned file, which looks like this:
> <?xml version="1.0" encoding="utf-8"?> <manifest
> xmlns:android="http://schemas.android.com/apk/res/android"
> package="com.csdcorp.speech_to_text" >
>
> <uses-sdk android:minSdkVersion="21" />
>
> </manifest>
changing the 21 to 16 is reverted after the attempt to run this app.
How to handle this
1. technically, ie. what is the workaround for this minSDK limitation - one that is at least worth trying?
2. A step back, if there are version issues, how do you do to avoid them?
Thanks a lot
Edit the build.gradle file in app folder. Search defaultConfig, edit the minSdkVersion from 16 to 21.
File path.
android\app\build.gradle

Cannot get Cordova project building in VS2015 with the facebook connect plugin

I've tried everything, but cannot seem to get it working. I've done the following:
1.Remove the plugins with the variables via the config designer.
2.Update to Cordova 5.0.0 via the config designer (Platforms > Cordova CLI)
3.From the command line: 1.Go to your project directory.
2.Type the following substituting the plugin name for the plugin you wish to add:
3.npm install -g cordova
4.cordova plugin add nl.x-services.plugins.launchmyapp --variable URL_SCHEME=myscheme
But I still cannot build. Here is the detailed output from MSBUILD :
http://pastebin.com/7enSzCxs
And a highlight of some of the errors I'm getting
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
1> F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\custom_rules.xml:4: F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\ant-build does not exist.
And
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:470: The following error occurred while executing this line:
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:441: Unable to delete directory F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\bin
And finally
1>
1> F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\node_modules\q\q.js:126
1> throw e;
1> ^
1> Error code 1 for command: cmd with args: /s /c "ant debug -f F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\build.xml"
1> Command finished with error code 8: F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat --debug,--ant,
1>MDAVSCLI : error : F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat: Command failed with exit code 8
1>Done executing task "MdaVsCli" -- FAILED.
1>Done building target "BuildMDA" in project "fbtest.jsproj" -- FAILED.
1>Build FAILED.
Any ideas at all? Using a fresh install of VS2015 with the tools for cordova, trying to build for android.
EDIT:
So after taking the advice of Kamil Pajdzik below, I used build.bat to compile it and found some issues with my path being waaay to long. I mapped a drive to cut down the length and it will now build AOK from the build.bat.
Still no dice in Visual studio though (I assume this is difference between build.bat using gradle and vs using ant).
My only error now is :
1> -code-gen:
1> [mergemanifest] Merging AndroidManifest files into one.
1> [mergemanifest] Manifest merger disabled. Using project manifest only.
1> [echo] Handling aidl files...
1> [aidl] No AIDL files to compile.
1> [echo] ----------
1> [echo] Handling RenderScript files...
1> [echo] ----------
1> [echo] Handling Resources...
1> [aapt] Generating resource IDs...
1> [aapt] Z:\fbtest\platforms\android\bin\AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'value' with value '#string/fb_app_id').
1> [aapt]
1> [aapt] Z:\fbtest\platforms\android\bin\AndroidManifest.xml:15: error: Error: No resource found that matches the given name (at 'label' with value '#string/fb_app_name').
1> [aapt]
1>
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:653: The following error occurred while executing this line:
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:698: null returned: 1
1>
Okay, this appears to be the issue. There are two problems. The first is a max path size issue on Windows. The issue is that it the plugin uses part of the the app's ID to create a folder, and VS by default uses a random identifier that is fairly long so this exacerbates the issue.
To resolve:
Update the ID for your project to something short (com.myproject.short)
Move the project to the root of your drive
Go to the project folder and re-add the android platform. From the command line:
cordova platform remove android
cordova platform add android
The second issue that then remains is an "Ant" build seems to be missing a folder which likely is a bug. If you add the "ant-build" folder in the location it complains about the build succeeds.
Also - Be sure plugins/fetch.json is included in your checkins since this is where your plugin variables are stored. If that file is deleted, you'll need to remove and re-add the plugin again. From your update it sounds like either VS is still set to use Cordova 4.3.0 and/or plugins/fetch.json does not contain your plugin variables. You should see something like this if the plugin was added using Cordova 5.0.0:
{
"com.phonegap.plugins.facebookconnect": {
"source": {
"type": "registry",
"id": "com.phonegap.plugins.facebookconnect"
},
"is_top_level": true,
"variables": {
"APP_ID": "123",
"APP_NAME": "nbaer"
}
}
}
The "variables" section is what may be missing.
Try running F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat from a command line. It usually gives more information.
Cordova 5.0.0 requires Android SDK in version 22. You can check if you have that installed via SDK manager.
This particular plugin appears to have some challenges with Cordova 5.0.0. Android underwent significant changes in this release that may be causing issues.
https://github.com/Wizcorp/phonegap-facebook-plugin/issues/1010
I am seeing failures if you build either with Ant or Gradle using a pure Cordova command line interface project. Likely a plugin fix is required to resolve the issue. I reccomend adding comments to this defect to help the plugin author resolve the issue.
So thanks to Chucks help, I managed to get a build working. It was indeed a combination of path length exceeding 260 characters (which I solved by mapping my solution directory to a drive) and a couple of folders not being created.
They were in my case :
F:\Git\CordovaFb\FBTest\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes
and
F:\Git\CordovaFb\FBTest\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\ant-build
I seem to have to manually recreate these from time to time as they get deleted on some builds...
So the full process is as follows (for others who have the same issue)
1) Create your solution in as short a path as possible (map a drive if you need to)
2) Add your cordova project to the solution, double click config.xml, goto platforms and change the CLI version to 5.0.0
3) Fire up a command prompt in the solutions root
4) Type the following cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="00000000" --variable APP_NAME="My App"
5) When its done you'll have the plugin in the plugins dir and the fetch.json file should contain the variables you entered for appid and appname
6) Do a full build and you'll get some errors (Exit code 8)
7) Manually create the following :
[Solution Route]\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes`
and
[Solution Route]\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes`
8) Your build should succeed! Check periodically if those paths still exist.
This should get you by until the next release of the cordova tools for VS (if they fix it)
platforms\android\AndroidManifest.xml
just change android:minSdkVersion="14" to android:minSdkVersion="15"