Categories
discuss

App removed from PlayStore because of library not in the project

I received an email from Play Store stating that:

We found that your app is using Tencent TBS SDK which contains code to download executable code (e.g. dex, JAR, .so files) from a source other than Google Play.

We never intended to use this library, in fact it doesn’t show up in the dependencies tree (./gradlew app:dependencies), but after we package the APK few references appear in the following files:

app/build/intermediates/transforms/dexMerger/xxx/release/0/classes2.dex
app/build/intermediates/transforms/proguard/xxx/release/0.jar
app/build/outputs/mapping/xxx/release/seeds.txt
app/build/outputs/mapping/xxx/release/mapping.txt
app/build/outputs/mapping/xxx/release/usage.txt
app/build/outputs/mapping/xxx/release/resources.txt

how do I find out which dependency is using this library? I tried to exclude it in gradle but nothing happens.

Answer

Unfortunately I didn’t find a clean way to find the library mentioned by the Play Store support. Every time I compiled the project, I would find the methods signature in the dex file. So I went for the empirical way:

  • Created an empty project with all of the gradle dependencies + modules
  • Compiled the project while commenting few of the dependencies out
  • When the dex file didn’t reference the library I was looking for, I knew I had found the culprit

Couple of notes:

  • the Play Store must’ve added this check in the last few weeks, since I had been using this library for the past 2 years.
  • The sources of the found dependency didn’t mention in their signature that library
Categories
discuss

Get unparsed element content

I want to get the content of an element without it being parsed. In this case the results should be é however all methods I tried parse the content and return é. How do I get the actual content.

console.log('javascript textContent:'+document.getElementById('test').textContent);
console.log('javascript innerText:'+document.getElementById('test').innerText);
console.log('javascript innerHTML:'+document.getElementById('test').innerHTML);
console.log('jQuery text():'+$('#test').text());
console.log('jQuery html():'+$('#test').html());
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="test">&eacute;</div>

Answer

The most simple approach would be to use a “backend” language to transform your given char since most of them (for example PHP and .net) provide a built-in function for that.

Unfortunately there is no existing vanilla function that implements this in javascript (at least not to my knowledge).

For example in php this would be:

string htmlentities(string $string....)

For javascript you could create your own solution. Basically create a list of your needed html entities or take a pre-defined list like this (https://raw.githubusercontent.com/w3c/html/master/entities.json) and work from there on.

Iterate over each object and check if your searched character (é) is present in an object.

To speed up the process I’d save the JSON file to your webhost and maybe reduce its size by removing not needed entities.

It may not be the most beautiful solution but definetly does the job pretty well.

let element = document.getElementById('test').textContent;


fetch("https://raw.githubusercontent.com/w3c/html/master/entities.json")
  .then((resp) => resp.json()) // Transform the data into json
  .then(function(data) {
    Object.keys(data).forEach(function(key){        
    if (data.hasOwnProperty(key)){
        if(data[key].characters === element) {
          console.log(key);
        }
    }
});
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="test">&eacute;</div>
Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..