0

I use DexGuard, build project in release mode with this:

proguardFile getDefaultDexGuardFile('dexguard-library-release-aggressive.pro')

Everything was fine, but now I need to keep another class from encrypting, I added lines to do not encrypt my ExampleBuilder:

-verbose

# do not encrypt API package
-keep public class com.justexample.api** {
public protected private *;
}

#these 3 lines below I added
-keep public class com.justexample.ExampleBuilder.** {
    public protected private static *;
}

-repackageclasses com.justexample

And now when I try to use library i get error:

error: attribute 'android:name' in <service> tag must be a valid Java class name.
Message{kind=ERROR, text=error: attribute 'android:name' in <service> tag must be a valid Java class name.

Generated manifest (from AAR which on dexguard influences) from which is this error, fragment where is error:

<service
        android:name="com.justexample.services.゚"
        android:exported="false" />
kamilf
  • 157
  • 1
  • 3
  • 15

1 Answers1

0

android:name is supposed to have reference of your class path which represents the activity. It must not contain any special characters or spaces.

I believe in your manifest under android:name tag u kept an additional Space and Full stop (.)

try to remove it and check

<service
        android:name="com.justexample.services"
        android:exported="false" /> 

If you have a specific name for your service class mention it completely and check like below

  <service
            android:name="com.justexample.services.SampleIntentService"
            android:exported="false" /> 

Update: From your comments,

Remove this line from Dexgaurd and check

-repackageclasses com.justexample
King of Masses
  • 18,405
  • 4
  • 60
  • 77
  • But unfortunately this Manifest comes from Android Library (AAR) which I develop and use Dexguard. I build my AAR with dexguard and later I use this AAR in my android test application and I get error that Manifest from AAR is invalid. In source code AAR my manifest is correct. Dexguard encrypts classes and also changes AAR manifest. But this is werid, because everythings was fine until I added lines to keep another one class from encryption - Builder. When there was not lines to keep Builder from encryptiong the generated manifest was OK and no errors. – kamilf Nov 20 '18 at 09:09
  • In test application I do not use Dexguard. And second - If you look on my 2nd section with dexguard-project config, when I delete 3 lines (under comment there) from that config I can use correctly my dexguarded AAR in test application. Only when I try to exclude one class from encryption, the result is, that I open test application project and get error that Manifest from AAR is incorrect. It's not correlated in my opinion and this is weird. When I do not exclude one class from encryption, there is no error that android:name in service is incorrect. – kamilf Nov 20 '18 at 09:29
  • 1
    remove this line and check -repackageclasses com.justexample – King of Masses Nov 20 '18 at 09:41