GoogleAdMobAdsSDK-4.0.2.jar and google GSON - android

I recently downloaded the newest GoogleAdMobAdsSDK-4.0.2.jar to use in
my Android project. My project also uses the gson-1.5.jar library.
After importing the GoogleAdMobAdsSDK-4.0.2.jar and build, the Console
reports this error:
[2011-03-25 11:28:37 - <appname>] Error generating final archive:
Found duplicate file for APK: assembly-descriptor.xml
Origin 1: C:\Users\<myusername>\Documents
\admob4\GoogleAdMobAdsSDK-4.0.2.jar
Origin 2: C:\Users\<myusername>\Documents\gson\gson-1.5.jar
When i remove the gson-1.5.jar from the project, this error goes
away. I would like to use GSON in my project.
What is the problem
here? How can i use both GSON and GoogleAdMobAdsSDK-4.0.2.jar?
edit: just updated GSON to 1.6, same problem

I am having the same problem as you.
I couldn't fix it so I go back to an older version. You can get the jar that I am using from my github repo.
This is totally an admob issue and I hope they fix it soon. Someone should answer your question.

Admob includes GSON internally so you should probably use theirs. Other than that you can play around with the classpath and hope it doesn't break admob.
Although in the latest 4.1.0 it seems they removed it.

Related

Gradle issue with sceneform - Program type already present: com.google.ar.schemas.lull

I am working on a project that will have a 3D model viewer in one fragment. In order to do so, I decided to use sceneform.
I downloaded sceneform plugin into Adnroid studio, downloaded and extracted sdk from Github, and I also copied libsceneform_runtime_schemas library into my project. I've added to my sceneform buil.gradle file line
implementation files("../libs/libsceneform_runtime_schemas.jar")
but that results in an error:
Program type already present: com.google.ar.schemas.lull.AabbDef
It is worth noticing that this is the first file in the jar under this path - which probably means that there will be more collisions.
If I'd try not to implement this library, then I get an error:
error: package com.google.ar.schemas.sceneform does not exist
I am using ar:core:1.17.0, and minSdkVersion 24 in sceneform gradle.
I've cleaned and rebuilt the project, Invalidate Caches/Restart, and added multiDexEnabled- although I am not sure if I did it correctly.
By using gradlew sceneform:dependencies I didn't find mentioned file.
I don't know how I can move forward, any help is much appreciated. If I can provide additional information, please let me know.
Edit 1:
I've also tried to work with
implementation files("../libs/libsceneform_runtime_schemas.jar"){
exclude ...
}
But I couldn't make it work. I wonder if that could be my solution.
Also, why does it try to implement this class since it already exists? Shouldn't there be some sort of check for that?
I solved my problem by restoring my project from repo to the last moment before including sceneform, and I proceeded with all of the steps again; Gradle dependencies to the libsceneform_runtime_schemas, min java 8, min SDK version, copying scenformscr and sceneformux to my project again, and lastly - upgrading all classes to AndroidX.
After two days almost I couldn't remove the error, and I don't know what went wrong before, but this time it works like a charm.
TL;DR - I removed the sceneform from my project and imported it again.

How to find which files are using a particular external library in an Android Studio project

The problem
Under "External Libraries" in the project view of an Android Studio project I have these libraries "stax-stax-api:1.0.1#jar" and "xpp3:xpp3:1.1.3.3#jar". They're causing me problems such that I can't build the project. I can't seem to figure out how they got there or where they're being used.
The error message I get when I build right now is:
"Error:Error: xpp3 defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]"
The error message is good except that it doesn't tell me who's using this lib in the first place.
The question
Is there an easy way to find out where they're being used in the project? Or even a way that it's easy but doesn't require looking at every file? It's a multi module project with lots of files. If I could delete them this would tell me but there's no delete option.
This could be something really simple that I'm overlooking. Any help appreciated. Happy to add more info as requested.
What I've tried
I've tried to "Analyze Dependencies" but it doesn't show me any references that I can see.
Update: I forgot to mention that I've also tried ./gradlew app:dependencies but it only tells me that my project depends on these libraries. I already know this. Is there a way to get some more specific information so I can remove the libraries?
Update 2: The accepted answer does work but I needed to redirect console output.
gradle app:dependencies
It will show you the dependencies tree of your project
At this link it is explained quite well about the command and how to use it.
Use this to redirect console output if it's clipped:
./gradlew app:dependencies > dependencies.txt
Project can be explored in "Project-tool-window" to have a look at the used external libraries which are not visible in "Android tool Window".
https://www.jetbrains.com/help/idea/project-tool-window.html
That way I solve my problem. Hope it help.

Could not find com.facebook.fresco:fresco:0.14.1

I'm trying to update the fresco library to the latest version (0.14.1) in the build.gradle file as per the instructions specified by the official website.
It worked when I used earlier version but can't update to the new one.
Below is the error message.
Error:Could not find com.facebook.fresco:fresco:0.14.1.
Required by:
Coupon:app:unspecified
Search in build.gradle files
I've invalidated and cached the Android Studio. I've re-build and cleand the project number of times. It is of no use.
Edit: 0.14.1 should now work.
Previous answer:
Please use 0.14.0 for now. 0.14.1 will be available shortly, we're still in the process of publishing the update.
I had the same issue, after banging my head for hours I realised that was caused by proguard configuration, I copied the most up to date rules from here and it dissappeared.

Unable to build for android with facebook sdk and google play together in Unity 5.3.4

I am using facebook-unity-sdk-7.3.0 and GooglePlayGamesPlugin-0.9.32 in my project. it does not let me build for android and fails with error 'Unable to convert classes into dex format. See the Console for details.'. It starts working again when I delete any of the sdk fb or googleplay from my project.
Console error
CommandInvokationFailure: Unable to convert classes into dex format.
See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java
-Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/shoaib/Library/Android/sdk/tools"
-Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar"
and
Error building Player: CommandInvokationFailure: Unable to convert
classes into dex format. See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java
-Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/shoaib/Library/Android/sdk/tools"
-Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar"
I did some research on it and found that this issue is related to two same jar files in the project but in my project, I unable find any duplicate jar file.
Edited
for reproducing the issue, I have made a sample project which can be downloaded from here http://wikisend.com/download/966354/LeaderboardTest.zip
Go to Assets->FacebookSDK->Plugins->Android->libs then delete android-support-v4.jar. There is a conflict there because it contains a class from another jar or aar file.
'Unable to convert classes into dex format. See the Console for details.'.
this one shows up when a class/dll exists twice in the project.
Often it happens when updating framework, if you do not remove the old version properly, then some classes may appear twice.
Since they are stored in plugins folder, Unity does not check them and they only show up in build process.
Best could be to remove everything related to both plugins and reimport them. That solved it for me when using UniWebView and Vuforia in same app. One of those was not properly updated.
In my case I could solve this problem by removing Android SDK Build-Tools version 24 and replacing it with version 23.
Maybe it's too late to answer, I was facing the same issue, I created a plugin this plugin contains Facebook SDK+Admob+unityads +unity IAP, all of them work together, I've created this plugin in unity 5.6.0, but I've checked it, it is working fine in unity 2017 as well, there is a scene "DemoScene", just open it everything is implemented, unity ads, admob, facebook share with callback, unityIAP.
Note: before importing the plugin kindly delete all the old plugins, also go to services and turn on unity ads.
http://www.mediafire.com/file/ccvj7ixir8ive25/FB_ADMOB_UnityIAP_UnityAds_Plugin_Hameed_Ullah_jan.unitypackage

Can't Build Signed Application, Only Unsigned Works, failed to convert to dalvik format

Please read all before deleting or voting down, thanks :)
I have an app that uses:
1-ActionBarSherlock
2-ViewPaerIndicator
3-PullToRefresh
When I try to build a signed version of it, fails with 'Failed to convert to dalvik format'
the problem is that I have no errors, nor lint warning
can anybody help with how to debug it or how to solve this,
I've followed many answers in here but nothing really helped,
The only common thing in the above dependencies that I know; is the support library, which I made sure that it's the same version in both ViewPagerIndicator and ABS, I tried to remove it from any of the 2 dependencies but the build failed, even for the unsigned version.
Update:
Update I found a solution for this, I removed the Support Lib. v13 and replaced it with V4 in all occurrences and it worked.
Although I found some answer that said don't use v13 and v4 together, but this wasn't my case I was only using v.13
Update I found a solution for this, I removed the Support Lib. V13 and replaced it with V4 in all occurrences and it worked.

Categories

Resources