how to change default gradle.properties of Unity? [duplicate] - unity3d

Since I want to add Firebase to my Android Game I want to include Google Auth. But I have the following Problem. I need to add some Code to the build.gradle File but I cant find it in my Unity Project.
Here is the manual I found from Firebase : https://firebase.google.com/docs/auth/android/google-signin
I searched on all my Drives for build.gradle but found nothing.
Can you tell me where I find it or what do I have to do to implement the Code from the Link?

To use Gradle in Unity.
1.Go to <UnityInstallationDirecory>\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates, then copy mainTemplate.gradle file to your <ProjectName>Assets\Plugins\Android folder.
2.You can then modify mainTemplate.gradle to be whatever you want it to be. Now, to make sure the build uses the gradle file, change the Build System to "Gradle (New)".

From Unity v2018.3 onwards, you can add your own custom Gradle build file by simply enabling the Custom Gradle Template property on the Player window
(which can be accessed by File > Build Settings > Player Settings > Publishing settings).
This generates a default mainTemplate.gradle file for you, which you can edit.
It will be in the location: Assets/Plugins/Android/mainTemplate.gradle
Source: https://docs.unity3d.com/Manual/android-gradle-overview.html

Related

How to prevent resetting of the files present in Packages section in Unity

I am working with Vuforia in Unity 2019.2.5f1 and building the project for Android. I have some Vuforia related files in the Packages section which I have edited to make some part of the project work. Everything works fine and the changes made in that file are visible when I run the project in my device directly by using the Build and Run option.
However, I also want to do some additional stuff in the project using Android Studio. For that, I export the project by checking the Export Project option in Build settings. The exporting is done fine, but the Package file in which I made some changes, is reset to its original data. The exported project (which is an Android Studio project) does not reflect the changes as well. Other files present in Assets section work fine and changes are visible, but not the files present in the Packages section.
Basically, I have a file in the Packages section which I need to change, but the changes are not reflected in the exported project. But, are visible when I run the project directly from Unity in my device. I want those files not to reset. I need some guidance on how to achieve this.
I am not very experienced in Unity. Any help in this regard is appreciated.
Thanks
In short: Do not edit anything in the Packages .. they get recompiled/imported automatically and in simple words: You can't prevent it.
What you can do however is copy the entire according folder from the Library over into the Assets and thereby make them local files you can then edit. See Embedded Dependencies
As mentioned in this thread by Unity Technologies (22.05.2019)
Yes, currently the way to develop a package is to copy/move it to your project's Packages folder.
Also see Copying a Unity package from the cache for further information.
In general no changes should be necessary to a Package directly. Maybe you should rather implement your own script and only copy the original content and then rather make your changes their?

Changes to HTML files not showing on built phonegap 3.0 app

So I have a Phonegap 3.0 app (project folder), and it's project (project/platforms/android) on Eclipse.
The problem is that when I change project/www/index.html , and tell Eclipse to Run the project, the changes don't appear on my device.
I noticed that Eclipse was saying Application already deployed. No need to reinstall. so I tried adding a space in a .java file so that Eclipse would notice some change in the project and rebuild it. It worked, Installing RingTo.apk... Success! showed on the log, but still the changes to index.html didn't show at the device...
Changes made to the files inside project/www/ are not automatically copied to your project (in your case to project/platforms/android/assets/www/). You have to run the following command to iteratively copy the changes to platform specific projects and build them. Open the command prompt and navigate to the root of the project (In this case project/). Or you can even right click on the project/ folder while pressing the shift key. Then run the following command:
cordova build
You can optionally limit the scope of each build to specific platforms:
cordova build android
Alternatively, you can run the following commands:
cordova prepare android
cordova compile android
In this case, once you run prepare, you can use Eclipse with ADT installed as an alternative to modify and compile the "platform-specific code" that Cordova generates within platforms/android.
Source - Cordova Docs
So, when you have made a slight modification in a .java file (which is an android platform specific file) and tried to rebuild it within Eclipse, you were actually trying to rebuild the same project without any actual modifications.
Another alternative would be to copy the files within the project/www/ to project/platforms/android/assets/www/ by hand and then build it within Eclipse, which would, of course, be an unnecessary pain.

How to fix Google Play Services 2 Library install to Eclipse

I've tried to follow https://developer.android.com/google/play-services/setup.html instructions in Eclipse for Mobile Developers (Juno), but am getting multiple errors with the library package after importing the library project into my workspace. I fixed the AndroidManifest.xml error it reported, but now I can't open the project in Eclipse saying the .project description file contains invalid information. So much for a simple install. I've tried uninstalling it, redownloading it, and I still get the multiple errors. Any suggesions how to get it working?
There is a misleading step in step 3 of http://developer.android.com/google/play-services/setup.html:
Copy the
/extras/google/google_play_services/libproject/google-play-services_lib
library project into the source tree where you maintain your Android
app projects.
If you are using Eclipse, import the library project into your
workspace. Click File > Import, select Android > Existing Android Code
into Workspace, and browse to the copy of the library project to
import it.
Don't do the first copy. Instead just do the second part and check the box that says "Copy projects into workspace". I found that if I did the first part I would end up with empty xml files.
Try the following :
https://developers.google.com/maps/documentation/android/intro#sample_code
You would get errors while opening an activity mentioned in the sample code. That is because android.support.v4.app.FragmentActivity is not added to your build path. Hover over the error and click on "Fix Project Setup". It would ask you to add the lib to the build path. Say Yes and enjoy :)
If your google_pay_services/libproject is empty (mine was empty) and looks like installed in sdk manager, first delete google play services from sdk manager, install it again and follow the steps in the first answer.
Try Window > Android SDK Manager > Extras > Google play service > Delete package.
And then re-install that package again:
File > Import, select Android > Existing Android Code into Workspace
I had the same problem. I went to Properties->Java Build Path and clicked on the Projects tab. Then I added google-play-services_lib using the Add button. This got me this run-time exception:
E/AndroidRuntime(9469): Caused by: java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment
So then I changed the main.xml file entry from this:
android:name="com.google.android.gms.maps.MapFragment"
to this:
android:name="com.google.android.gms.maps.SupportMapFragment"
And FINALLY, it runs, but NOW no map due to authorization failure. So I am off on another search.
thanks Google for making it so complicated and for posting incorrect instructions!

How the launcher of eclipse Plugin development project loads\handles the "plugin.xml" file?

I want to figure out how can I put a file in the root folder of the project and use it in run time, there it will be accessible.
The problem that I have by doing that (placing the file in the root folder)-is that by default it means:
It is not in the classpath of the project.
It is not copied to the bin (output) folder.
I can’t see how my modifications of the file will affect the run process.
As I know there is a similar mechanism in eclipse that does the same:
The Plugin development project has a file-"plugin.xml" in the root folder of the project.
When you make a change in the file without building the project or copying it to the bin folder the changes take place when you run it.
example:
add an extension point in ”plugin.xml” and hit “RUN”, it will take place immediately.
Does anybody have an idea how this mechanism works in eclipse?
Edit - for clarification :
I am interested in how the launcher of eclipse Plugin development project loads\handles the "plugin.xml" file.
I assume when you say you want to put a file in a "root folder of the project" you are refering to a plugin that you are developing and then in runtime you want to get access to that file. Please don't vote me down if I did not understand that question correctly but based on my understanding here are some steps to follow:
Open your MANIFEST.MF file /MANIFEST.MF, this will oepn a multipage editor.
Click on the build tab (third from right).
This is where you specify what resources in your plugin you want the builder to include in the plugin at runtime. You will notice that plugin.xml is already checked which is why extensions get updated each time.
Check the resource on this editor page for the resource you want to be able to load and access at runtime. Behind the scenes this is updating your build.xml which the internal builder uses to figure out what sources to build/add when building/exporting the plugin.
One you have done that this is how you can get access to that file, you get the Bundle for your plugin and call the getEntryMethod with the path to your file and then open in inputstream from there you can load it as a File or whatever you want. Code example below: Hope this helps - Duncan
Bundle myBundle = Platform.getBundle("com.mycompany.myplugin.id")
InputStream in = myBundle.getEntry("/myfile.txt").openStream();

Build dependencies and static libraries in Xcode 3

I'm trying to get the example project for an SoundCloud API wrapper working using XCode 3. There are some few basic instructions at the start, but I'm having trouble:
QuickStart
In your terminal:
git clone
git://github.com/soundcloud/cocoa-api-wrapper.git
SoundCloudAPI cd SoundCloudAPI git
submodule update --recursive --init
In your Xcode project:
drag SoundCloudAPI.xcodeproj into your project
add it as a build dependency
add the static library as
a liked target
add "[relative path to
SoundCloudAPI]/Sources/SoundCloudAPI"
to your header search path in the
build settings
you can also include
the OAuth2Client headers by adding
"[relative path to
SoundCloudAPI]/Outsourced/OAuth2Client/Sources/OAuth2Client"
too (although you might not need
them)
I've completely ignored the part before In Your Xcode project. I think I've done everything correctly to add the build dependency following this post, the frameworks are still marked in red as if they were missing. Any advice?
Also the three points after that are also not very clear? Could someone explain these in a bit more detail? For example, where is the header search path? and where are the build settings?
Thanks so much!
Tip: Given that you've tagged this question with iphone, I'll assume you're building an iPhone app. In that case, you need to add libSoundCloudAPI.a as a direct dependency, but not SoundCloudAPI.framework.
To set the header search path in Xcode 3:
Ctrl-click your app's target (inside Targets in the Group & Files panel on the left hand side) and choose Get Info
Click the Build tab - these are the build settings! :-)
Set Configuration: to All Configurations, Show: to All Settings
In the Search Paths section, update Header Search Paths