I recently updated my code base to Androidx and now trying to build production variant using the command
> ./gradlew assembleProduction
It keeps on building at the process transformClassesAndResourcesWithProguardForProductionRelease
Here is the output
Note: com.google.android.gms.measurement.internal.zzgp: can't find dynamically referenced class com.google.android.gms.tagmanager.TagManagerService
Note: com.google.android.gms.measurement.internal.zzs: can't find dynamically referenced class android.os.SystemProperties
Note: com.google.android.youtube.player.internal.aa: can't find dynamically referenced class com.google.android.youtube.api.locallylinked.LocallyLinkedFactory
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: io.fabric.sdk.android.FabricKitsFinder: can't find dynamically referenced class com.google.android.gms.ads.AdView
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE8PlatformImplementations
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE7PlatformImplementations
Note: okhttp3.internal.platform.AndroidPlatform$CloseGuard$Companion: can't find dynamically referenced class dalvik.system.CloseGuard
Note: okhttp3.internal.platform.AndroidPlatform$Companion: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform$Companion: can't find dynamically referenced class com.android.org.conscrypt.OpenSSLSocketImpl
Note: okhttp3.internal.platform.ConscryptPlatform$Companion: can't find dynamically referenced class org.conscrypt.Conscrypt$Version
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: the configuration refers to the unknown field 'com.google.android.gms.common.api.internal.BasePendingResult$ReleasableResultGuardian mResultGuardian' in class 'com.google.android.gms.common.api.internal.BasePendingResult'
Note: the configuration refers to the unknown method 'com.android.vending.billing.IInAppBillingService asInterface(android.os.IBinder)' in class 'com.android.vending.billing.IInAppBillingService'
Note: the configuration refers to the unknown method 'com.google.android.gms.measurement.AppMeasurement getInstance(android.content.Context,java.lang.String,java.lang.String)' in class 'com.google.android.gms.measurement.AppMeasurement'
Note: the configuration explicitly specifies 'sun.misc.Unsafe' to keep library class 'sun.misc.Unsafe'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParser'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserException'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserFactory'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlSerializer'
Note: the configuration explicitly specifies 'android.widget.Space' to keep library class 'android.widget.Space'
Note: there were 7 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 3 references to unknown class members.
You should check your configuration for typos.
Note: there were 6 library classes explicitly being kept.
You don't need to keep library classes; they are already left unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
Note: there were 49 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 1 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclasscast)
Ignoring unused library classes...
Original number of library classes: 24139
Final number of library classes: 2071
Printing kept classes, fields, and methods...
Inlining subroutines...
Shrinking...
Printing usage to [/Users/harsh/git/Mobile_Android_MVA/app/build/outputs/mapping/production/release/usage.txt]...
Removing unused program classes and class elements...
Original number of program classes: 21242
Final number of program classes: 21242
Optimizing (pass 1/5)...
<=<============-> 99% EXECUTING [14m 57s]
> :app:transformClassesAndResourcesWithProguardForProductionRelease
My gradle.properties looks like this
> org.gradle.jvmargs=-Xmx3096m -XX:MaxPermSize=512m
> -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
>
> org.gradle.parallel=true org.gradle.daemon=true
> # Disables R8 for Android Library modules only. android.enableR8.libraries = false
> # Disables R8 for all modules. android.enableR8 = false android.useAndroidX=true android.enableJetifier=true
>
> org.gradle.configureondemand=true
I am using proguard and release buildType has following
minifyEnabled true
useProguard true
shrinkResources true
zipAlignEnabled true
debuggable false
I tried with and without androidx proguard but same result
-keep class androidx.appcompat.widget.** { *; }
-dontwarn com.google.android.material.**
-keep class com.google.android.material.** { *; }
-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }
Can you please help me how to solve this so I could generate a signed apk
Which version of Android studio are you using? 3.4?
What happens when you compile with R8 instead of Proguard? Sometimes error messages are more explicit.
Related
I have a groovy class "Utils.groovy" which contains the method "makeHttpCall()".
This is a summarized version of the method:
static String makeHTTPCall() {
...
request.setHeader(javax.ws.rs.core.HttpHeaders.AUTHORIZATION, authHeader)
...
}
The compiler complains:
Groovy:Apparent variable 'javax' was found in a static scope but
doesn't refer to a local variable, static field or class.
If I make the method non-static though, it will stop complaining;
String makeHTTPCall() {
...
request.setHeader(javax.ws.rs.core.HttpHeaders.AUTHORIZATION, authHeader)
...
}
this way it doesn't complain. Why does the compiler complain about this?
Note that the method runs with no problems; it is run as part of a Jenkins shared library.
Thanks!
EDIT: Using
import javax.ws.rs.core.HttpHeaders gives
Groovy:unable to resolve class javax.ws.rs.core.HttpHeaders
So that class is not resolvable by the compiler, but it is when run inside Jenkins.
You need to add the library that provides "javax.ws.rs.core.HttpHeaders" to your project's buildpath. Alternatively, you can use an #Grab to your class/script. This is probably not what you want in this case since Jenkins is providing that dependency at runtime.
I currently have two classes that I created within /etc/puppet/modules/params/manifests/init.pp
class modulename ($variable_name = 'Any string') inherits modulename::params{
file { '/tmp/mytoplevelclass.sh' :
mode => '644',
ensure => 'present',
content => $variable_name
}
}
class modulename::params{
}
However, I am having an issue declaring these classes in /etc/puppet/manifests/site.pp. Currently, I have it written as
node default { #client
class { 'modulename':}
class { 'modulename::params':}
}
I know that this is incorrect because when I run puppet agent -t on the client I get an error stating
Could not find declared class modulename at /etc/puppet/manifests/site.pp
I have tried several different configurations and still am unsure on what to do.
Puppet determines the file in which it expects to find a class's definition based on the class's fully-qualified name. The docs go into it in some detail; in particular, you should review the Module Fundamentals. (I am guessing that you are on Puppet 3, but the details I am about to discuss are unchanged in Puppet 4.)
Supposing that /etc/puppet/modules is a directory in your modulepath, it is a fine place to install (or write) your modulename module, as indeed you indicate you are doing. If it is not in your module path, then you'll want either to move your module to a directory in the module path, or to add that directory to the module path. I assume that you will resolve any problem of this sort via the latter alternative, so that /etc/puppet/modules/modulename is a valid module directory.
Now, class 'modulename' is a bit special in that its name is also a module name; as such, it should be defined in /etc/puppet/modules/modulename/manifests/init.pp. Class modulename::params, on the other hand, should follow the normal pattern, being defined in /etc/puppet/modules/modulename/manifests/params.pp. I anticipate that Puppet will find the definitions if you put the definitions in the correct files.
Bonus advice:
Use include-like class declarations in your node blocks, not resource-like declarations
Your node blocks probably should not declare modulename::params at all
I have implemented one app for s40 (Asha) using CodenameOne SDK, I want to implement In app Purchase for it (Nokia S40) but when I use Nokia_in-app_payment library and compile it so it give error below is mentioned error, could anybody please tell me how can I do it. Thanks in advance.
/*
**Executing: javac -source 5 -target 1.5 -classpath /tmp/build1853819559696327916xxx/tmpclasses:/home/ec2-user/j2me/midpapis.jar -d /tmp/build1853819559696327916xxx/tmpclasses /tmp/build1853819559696327916xxx/tmpsrc/MinerwaStub.java warning: [options] bootstrap class path not set in conjunction with -source 1.5
Note: /tmp/build1853819559696327916xxx/tmpsrc/MinerwaStub.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
Executing: java -jar /home/ec2-user/j2me/proguard.jar -injars . -libraryjars /home/ec2-user/j2me/midpapis.jar:/home/ec2-user/j2me/CLDC11.jar -outjars /tmp/build1853819559696327916xxx/result/Minerwa.jar -target 1.3 -keep public class ** extends javax.microedition.midlet.MIDlet { public *; } -defaultpackage '' -printmapping /tmp/build1853819559696327916xxx/result/obfuscation_mapping.txt -overloadaggressively -dontusemixedcaseclassnames -useuniqueclassmembernames -dontoptimize ProGuard, version 4.7
Reading program directory [/tmp/build1853819559696327916xxx/tmpclasses]
Reading library jar [/home/ec2-user/j2me/midpapis.jar]
Reading library jar [/home/ec2-user/j2me/CLDC11.jar]
Note: duplicate definition of library class [java.io.ByteArrayInputStream]
Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: duplicate definition of library class [java.io.DataInput]
Note: duplicate definition of library class [java.io.DataInputStream]
Note: duplicate definition of library class [java.io.DataOutput]
Note: duplicate definition of library class [java.io.DataOutputStream]
Note: duplicate definition of library class [java.io.EOFException]
Note: duplicate definition of library class [java.io.IOException]
Note: duplicate definition of library class [java.io.InputStream]
Note: duplicate definition of library class [java.io.InputStreamReader]
Note: duplicate definition of library class [java.io.InterruptedIOException]
Note: duplicate definition of library class [java.io.OutputStream]
Note: duplicate definition of library class [java.io.OutputStreamWriter]
Note: duplicate definition of library class [java.io.PrintStream]
Note: duplicate definition of library class [java.io.Reader]
Note: duplicate definition of library class [java.io.UTFDataFormatException]
Note: duplicate definition of library class [java.io.UnsupportedEncodingException]
Note: duplicate definition of library class [java.io.Writer]
Note: duplicate definition of library class [java.lang.ArithmeticException]
Note: duplicate definition of library class [java.lang.ArrayIndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.ArrayStoreException]
Note: duplicate definition of library class [java.lang.Boolean]
Note: duplicate definition of library class [java.lang.Byte]
Note: duplicate definition of library class [java.lang.Character]
Note: duplicate definition of library class [java.lang.Class]
Note: duplicate definition of library class [java.lang.ClassCastException]
Note: duplicate definition of library class [java.lang.ClassNotFoundException]
Note: duplicate definition of library class [java.lang.Double]
Note: duplicate definition of library class [java.lang.Error]
Note: duplicate definition of library class [java.lang.Exception]
Note: duplicate definition of library class [java.lang.Float]
Note: duplicate definition of library class [java.lang.IllegalAccessException]
Note: duplicate definition of library class [java.lang.IllegalArgumentException]
Note: duplicate definition of library class [java.lang.IllegalMonitorStateException]
Note: duplicate definition of library class [java.lang.IllegalStateException]
Note: duplicate definition of library class [java.lang.IllegalThreadStateException]
Note: duplicate definition of library class [java.lang.IndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.InstantiationException]
Note: duplicate definition of library class [java.lang.Integer]
Note: duplicate definition of library class [java.lang.InterruptedException]
Note: duplicate definition of library class [java.lang.Long]
Note: duplicate definition of library class [java.lang.Math]
Note: duplicate definition of library class [java.lang.NegativeArraySizeException]
Note: duplicate definition of library class [java.lang.NoClassDefFoundError]
Note: duplicate definition of library class [java.lang.NullPointerException]
Note: duplicate definition of library class [java.lang.NumberFormatException]
Note: duplicate definition of library class [java.lang.Object]
Note: duplicate definition of library class [java.lang.OutOfMemoryError]
Note: duplicate definition of library class [java.lang.Runnable]
Note: duplicate definition of library class [java.lang.Runtime]
Note: duplicate definition of library class [java.lang.RuntimeException]
Note: duplicate definition of library class [java.lang.SecurityException]
Note: duplicate definition of library class [java.lang.Short]
Note: duplicate definition of library class [java.lang.String]
Note: duplicate definition of library class [java.lang.StringBuffer]
Note: duplicate definition of library class [java.lang.StringIndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.System]
Note: duplicate definition of library class [java.lang.Thread]
Note: duplicate definition of library class [java.lang.Throwable]
Note: duplicate definition of library class [java.lang.VirtualMachineError]
Note: duplicate definition of library class [java.lang.ref.Reference]
Note: duplicate definition of library class [java.lang.ref.WeakReference]
Note: duplicate definition of library class [java.util.Calendar]
Note: duplicate definition of library class [java.util.Date]
Note: duplicate definition of library class [java.util.EmptyStackException]
Note: duplicate definition of library class [java.util.Enumeration]
Note: duplicate definition of library class [java.util.Hashtable]
Note: duplicate definition of library class [java.util.NoSuchElementException]
Note: duplicate definition of library class [java.util.Random]
Note: duplicate definition of library class [java.util.Stack]
Note: duplicate definition of library class [java.util.TimeZone]
Note: duplicate definition of library class [java.util.Timer]
Note: duplicate definition of library class [java.util.TimerTask]
Note: duplicate definition of library class [java.util.Vector]
Note: there were 74 duplicate class definitions.
Warning: com.mobifusion.minerwa.HomePage: can't find superclass or interface com.nokia.payment.NPayListener
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.NPayListener
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.PurchaseData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.PurchaseData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.ProductData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.ProductData
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.siemens.mp.game.Light
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.nokia.mid.ui.FullCanvas
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.mot.iden.util.Base64
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class mmpp.media.MediaPlayer
Note: there were 6 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Warning: there were 6 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.**
*/
Thanks,
Shailendra Gautam
You will need to set the build argument j2me.obfuscation=false and obfuscate on your own with the Nokia libraries.
I am trying to port some code from the Dropwizard examples from java to groovy.
I see that within java, I can use the following code without any issues:
package com.example.helloworld;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
#Produces(MediaType.APPLICATION_JSON)
public class HelloWorldService{
}
However, with the groovy compiler ( both 1.8 and 2.0.6 ), the class fails to compile with a noClassFoundException around MediaType.APPLICATION_JSON
If I change this code to use the actual string value
#Produces('application/json')
public class HelloWorldService{
}
everything works perfectly.
Are there any differences between the way groovy resolves annotations and the way that java does?
For completeness, this is part of a gradle project and here is my build.gradle ( the file goes under src/groovy/com/example/helloworld )
apply plugin: 'groovy'
// Set our project variables
project.ext {
dropwizardVersion = '0.6.1'
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.yammer.dropwizard', name: 'dropwizard-core', version: dropwizardVersion
groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.8.7'
}
The compilation error is:
Caused by: java.lang.RuntimeException:
java.lang.ClassNotFoundException:
com.sun.ws.rs.ext.RuntimeDelegateImpl ... 17 more Caused by:
java.lang.ClassNotFoundException:
com.sun.ws.rs.ext.RuntimeDelegateImpl at
org.gradle.api.internal.tasks.compile.TransformingClassLoader.findClass(TransformingClassLoader.java:47)
The problem is caused by an unfortunate limitation of the Groovy compiler, namely that it uses reflection to access classes on the compile class path. This may in turn trigger other classes to get loaded, which may not be available on the compile class path. Typically (but not always) these are runtime dependencies.
In the concrete case, the Groovy compiler loads javax.ws.rs.core.MediaType via reflection, which ultimately results in com.sun.ws.rs.ext.RuntimeDelegateImpl being loaded via Class.forName (triggered by a static initializer), which isn't on the compile class path. The solution is to put that class on the compile class path. (In the longer run, the solution is to fix the standalone Groovy compiler not to use reflection, and from what I know this is already in the queue.) If your module's transitive dependencies aren't an issue, the simplest way to achieve this is:
dependencies {
compile "com.sun.jersey:jersey-client:1.15"
}
I suspect that the Eclipse Groovy compiler doesn't have this problem because it doesn't use reflection to access the compile class path. I'd expect GMaven to blow up like Gradle, unless it is configured to use the Eclipse compiler (which isn't currently supported by Gradle).
I have a MonoTouch app that dynamically instantiates a class (using Type.GetType()) at runtime. The class is in an assembly that is not referenced anywhere else in the app, so the MonoTouch static compiler thinks that the assembly isn't used and ignores the assembly when it compiles the app. If I add a reference to the class in the app, then the compiler includes the assembly and the call to Type.GetType() works fine:
MyAssembly a;
I would prefer to just tell the compiler to always include all the assemblies listed in the project's "References" when it compiles the app. Is this possible?
Thanks,
-Tom B.
You will have to change your project's Linker behavior from "Link all assemblies" to "Link SDK assemblies only".
The other solution, if you have the project code that assembly was created with, is to mark the class you want to use with the PreserveAttribute.
Were you able to figure this out yet? If not, I had a similar problem: Is there a way to force MonoDevelop to build/load an assembly?
As I understand it, that's just how the C# compiler works. I was able to get around this by adding a custom pre-build step that scripts a class into the referencing assembly that includes dummy references to the unreferenced assemblies, like so:
using System;
namespace MyNamespace
{
public static class Referencer
{
Type t;
//These lines are scripted one per class in the unreferenced assemblies
//You should only need one per assembly, but I don't think more hurts.
t = typeof(Namespace1.Class1);
t = typeof(Namespace2.Class2);
...
t = typeof(NamespaceN.ClassN);
}
}