Categories

Follow Us @web_learners

Saturday, November 6, 2021

How to Fix could not parse the android application module's Gradle config || Add Firebase with Android Studio Project

November 06, 2021 0 Comments

 Hi Everyone!! Today We will fix the issue of "could not parse the android application module's gradle config. Resolve gradle build issue and/or resync".  

As we know if we want to connect Firebase with our Android Studio project, we can do it by manually add or can add by Android Studio Assistant Tools. 

So today we will try to add firebase with our Android studio project by firebase Assistant. For doing that first we need to go the "Tools" from upper bar. Then click on "Firebase" . After that in the right sight you will see the android studio Firebase Assistant has opened. And you will get the "Authentication" option, Click on that. After that you will see "Email and Password Authentication" ,  click on that.  

Now you will get the step of connecting Firebase with your Android studio project. First we will complete the first step which is Connect to Firebase. You can see in the video I am getting error after click on Connect to firebase. The Error is showing " Could not parse the android application module's Gradle config. Resolve gradle build issue and/or resync, So let's check what issue we have in Gradle file. 

As we can see our build screen showing that our build tool 31.0.0 is missing. So, Lets check and install the build tool 31.0.0 version. For checking that, click on Project Structure icon, 


then you will get the Android SDK window, there you will see all the SDK version tool, from there you can install any SDK in your project  or you can easily uninstall also.





As you can see in above image, my project already has installed SDK build tool 31.0.0,  now click on Show package details from bottom, now you will be able to see which version is installed in your project. As we see our project already has build tool 31.0.0 installed, let's try to build the project again.


Now you can see it's showing the error of "Installed Build Tools revision 31.0.0 is corrupted", So we need to solve this problem now.

For solving this, first click on project structure.





After click on "Project structure" , will open a window, in that window in the "Modules" section, you will see Compile SDK Version, there you need to select the version 30.0.0 and in the Build Tools Version, select the version 30.0.1 or 30.0.2 or 30.0.3 all are ok. Then click on OK. 

After that, your project will automatically start to sync, After syncing done, we will try to build our project and will check whether we solved our problem or not.

As you can see, our project successfully build, we have solved Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager"

Now let's check whether our main problem has solved or not. Which was "could not parse the android application module's gradle config. Resolve gradle build issue and/or resync" .

Let's try to connect Firebase again, now you will see, once you click on Connect to Firebese, it will automatically open your browser window and will go to Firebase console, you need to create a new project on firebase, or you can select your existing firebase project, then they will ask several permission, just click on  Continue, and at the last the Add Firebase this button will appear. click on that.  After that your Firebase project will ready and you will get the below image. 



Click on Connect.






As you can see our Android studio project is connected with Firebase successfully. So we have solved both problem of "could not parse the android application module's gradle config. Resolve gradle build issue and/or resync" and "Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager" successfully.

That's it. 

Monday, July 5, 2021

How to Enable File Upload and Download in Android Webview App | Webview App Development Series Part 19

July 05, 2021 1 Comments

 Hi Everyone, Welcome to our mobile app developer training. As we are Converting our website to apk, in the previous tutorial we have learned How to Enable Video, Image and File Upload in Android Webview App.

And we also have learned separately How to Upload files in Android Webview App and How to Download the files in the android webview app

Now we will combine uploading files and downloading files code together and will implement them in one Webview app project. 

First of all, you need to add 3 permission for "access camera, write in external storage and Internet" in your AndroidManifest.xml file. 


Code:

Then, we need to take some variables, such as:

Code:


After that, we will move to the "onCreate" method, and in the "WebChromeClient" function we will write the "onShowFileChooser" function.


Code:


Now we will write code for Downloading any files in Android Webview App. First, we will write a function for file saving permission to your device.


Code:


And then we will write code for allowing download file in the Webview app.

Code:


We have finished the coding within the onCreate method, Now we will write several functions outside of the onCreate method.


Code:


That's it, we have finished coding for Uploading and downloading files in the Android webview app. Let's run the project and test.




As you can see in the above picture, Downloading any file and uploading any type of file in Webview App is working perfectly. See you in the next tutorial.

Saturday, July 3, 2021

How to upload multiple files in webview android app | Webview App Development Series Part 18

July 03, 2021 1 Comments

 Hi Mobile App Developers, In the previous video we have learned that How to Enable File upload in Android Webview app. And I told in the last video that we will learn today how to upload multiple types of files together in the Android webview app.

As we saw in the last tutorial, we are able to upload any type of file such as Audio, Video, Txt, XL, Zip, PPT, etc. But we saw that we can only select one file and upload one file at a time,  So today we will learn How to select multiple files and upload multiple files together in the Android Webview app.

We will continue with the last tutorial code, If you have not followed that tutorial yet, first follow that tutorial, then continue this tutorial. Let's Start.

First, we will take a boolean variable, we will name it multiple_files, and the value we will store is "Yes".



Code:


Now we will move to the "onShowFileChooser" function, in that function you will find we have written code for file selection, now we will write code there for multiple file selection.


Code:


These codes will help you to select multiple files at a time in the Android webview app. Now let's see what will be the full code within the "onShowFileChooser" function.

Code:


Just need to add these line of code in "onShowFileChooser" function , and all the other code of Upload file in Webview (my last tutorial) are same such as "onActivityResult", "onConfigurationChanged""file_permission" , "create_image()", "create_video()".  Now let's run the project and check whether Multiple file selections and multiple file uploading in the Android webview app are working or not.


As you can see in the above picture, multiple file uploading working perfectly. This way you can convert your website easily. It works like website to apk converter

In the next, I will show you How to Enable Upload and Download in Android Webview App.

Sunday, June 27, 2021

How to Enable Video, Image and File Upload in Android Webview App | Webview App Development Series Part 16

June 27, 2021 8 Comments

 Hi, Everyone! I have got many requests and comment about "File upload not working in android webview app", also "can not uploading pdf or video file in android webview app", you all have requested me to help you for solving the problem.


Today I will solve all the problems about "How to enable or support file uploading in android webview app", "How to allow any type file uploading such as pdf, ppt, audio, video, image, txt"? anything you will be able to upload in your webview android apps. Just follow my tutorial from beginning to end. In the previous video, I have showed you How to Enable Download in Android Webview App.

So, Let's start, First of all, you need to add 3 permission for "access camera, write in external storage and Internet" in your AndroidManifest.xml file. 


Code:


After adding the permission, now need to move to the "MainActivity.java" file, now let's take 5 variable, which are: 

Code:


Let's demonstrate, why we have taken these variable,  we have taken a private static string file called "file_type", this is for storing file type we want to upload in our webview app, such as pdf, ppt, pptx, ppt, audio, video, image, doc, zip, RTF, txt, etc. 


As we want to allow all types of these files uploading in our android webview app, so we have defined file_type = "*/*". "*/*" this means it will allow all types of file uploading in the android webview app.


cam_file_data: This String variable "cam_file_data"  for storing camera file information.

ValueCallback<Uri> file_data: We have taken the "ValueCallback" variable, we have named it "file_data", this will store data after selecting the file.

ValueCallback<Uri[]> file_path: Another "ValueCallback" variable, we named it file_path, this will store file location.


Now let's move to the "onCreate" method, and will write a function method called onShowFileChooser in our setWebChromeClient, and all the necessary code will write on this function,  See the  Below Code:


Code:


Now we will write a function "onActivityResult"  for selecting the file from the Camera or SD card in android webview app.  This function will be outside of "onCreate" method. See the  Below Code:


Code:


Now we will write function called "onConfigurationChanged"

Code:


Now we will write a function "file_permission" for checking and asking for required file permissions.


Code:


We have taken a variable "photoFile"  in the "onActivityResult" function, there we have stored a function called "create_image()". Now we will create that function. 


Code:


Now we will write function for video file

Code:


We have finished the coding. Now Let's run our project and check whether any type of file is uploading in our android webview app or not.


    

Figure: How to enable file upload in webview android

As you can see from the above image, I have successfully uploaded an audio MP3 file, MP4 video file, and image. This way you will able to do android webview upload files, upload all types of files, pdf, ppt, audio, video, image, txt etc.


In the next tutorial, I will show you How to enable multiple file upload in the Android webview app.



Wednesday, January 20, 2021

How to Optimizing Ad Refresh in Mobile App Advertising

January 20, 2021 0 Comments

 Hello EveryOne, Today we will learn how to refresh ads automatically after a definite time. You can apply this code for every mobile ad network, such as AdMob, Applovin, Unity, Facebook ads, StartApp, AppColony, etc implement this code in the Webview application or in Any android application is okay. It will work for every android mobile app and every mobile ad network in Android Studio.


The code as follows:


Code:
 






In this Code, I have Set after 20 seconds new ad will automatically reload, If you want to change the time interval, you can do that. Thank you.

Monday, September 14, 2020

How to Set App icon in Android App | Webview App Development Series Part 16

September 14, 2020 0 Comments

 Hi, In the last post we have learned how to make App and image fit in all screen sizes. Today we will learn how to Set App icon in Android App or Webview App.

First, you need to right-click on "App" then click on "New" then click on "Image Asset". Follow the below picture.


After that, go to the "Background Layer", then select the asset type, you can select the color or image as a background asset type, as your wish. I will use color, you can see in the below picture, you can select any color by click on the color code, then select Choose.



After that, go to the Foreground Layer, you can set your icon with your custom image or clip art or text. I will use my app logo so I will select image as an asset type. Then click on folder icon in Path.




Then you can resize so that the icon looks perfect. Click "Next".



After click next, it will show you how your app logo looks in the Google play store. Then click on the Finish button.



That's it, now run your project again, and you can check the app icon in the emulator, you will see the app icon. So we have successfully set our app icon.




You can also follow the video for better understanding.


Monday, August 10, 2020

How to Show Exit Dialog in Android App || Exit Dialog on Home Screen

August 10, 2020 0 Comments

 Hi, In the previous post we have learned How to Show Exit Dialogue on Splash Screen in Webview App. Today we will learn How to show Exit Dialog in Home Screen (Main Activity). Let's Start.

As we will show Exit dialog in MainActivity.java, so we will set a function onBackPressed().In that onBackPressed() function we will take an if-else condition.

Code:


The "if" condition will be if our website or app can go back then it will go to the previous page,  else it will show Exit dialog. And in the exit dialog, there will be a message, such as "Do you want to Exit?" or anything you want to show to your users.


And there will also two buttons in the Exit dialog, One is the "Yes" button, another one is the "No" Button. Then we have to set "OnClickListener" on "Yes" and "No" both button. In that OnClickListener, we will define what will happen after the user clicks on buttons.


After that, we will set if the user clicks on the "yes" button app will Exit successfully. And if the users click on the "No" button the user will stay on the current page. Then have to show the alert dialog.


So all the code together will be:

Code:
 

And see the below code so that you can understand where you have put the above Exit Dialog code.


Code:
 


Now you can run your project. You can see below the image we have successfully added Exit dialog on Home Screen. Exit dialog working perfectly.


That's it. Thank you.